Each time apply-matrix-operator is called in order to apply a given gate, magicl-matrix-to-quantum-operator copies the relevant matrix into a newly-allocated array and then calls matrix-multiply to evaluate the matrix vector product. This linear algebra operation is entirely done on the Lisp side instead of using the underlying BLAS implementation (which is highly optimized by the hardware vendor --i.e., Intel, Apple, etc.).
I suggest:
using foreign storage for the matrices and the wavefunction (e.g., using static-vectors), and
using the underlying BLAS routines instead of the current code
I anticipate that, by doing so, we could significantly boost the performance of QVM and decrease consing by avoiding unnecessary allocations/copies (see https://github.com/rigetti/magicl/pull/60) when computing gate applications.
Each time
apply-matrix-operator
is called in order to apply a given gate,magicl-matrix-to-quantum-operator
copies the relevant matrix into a newly-allocated array and then callsmatrix-multiply
to evaluate the matrix vector product. This linear algebra operation is entirely done on the Lisp side instead of using the underlying BLAS implementation (which is highly optimized by the hardware vendor --i.e., Intel, Apple, etc.).I suggest:
static-vectors
), andI anticipate that, by doing so, we could significantly boost the performance of QVM and decrease consing by avoiding unnecessary allocations/copies (see https://github.com/rigetti/magicl/pull/60) when computing gate applications.