lanl-ansi / QuantumAnnealing.jl

Tools for the Simulation and Execution of Quantum Annealing Algorithms
Other
23 stars 5 forks source link

Generalize State Measurements #7

Open ccoffrin opened 2 years ago

ccoffrin commented 2 years ago

Add support for taking measurements on bases other than z.

zmorrell commented 2 years ago

@ccoffrin I have worked out the math and figured out how to do this reasonably efficiently. It looks like we will need to add the LinearAlgebra package to the dependencies though, since it will involve using the eigenvalue decomposition.

We could possibly ask users to provide a measurement basis as an argument and assume we don't need to perform an eigendecomposition, with each column of the matrix being the state onto which they want to project, but this could easily run into a multitude of problems.

Basically, it breaks down to returning the diagonal of the matrix (E' \rho E), where E is the matrix with columns corresponding to the state being projected onto. The probabilities will correspond as P(i) = tr(\rho E[:,i] E[:,i]').

In summary, do we want to do the eigendecomposition on an input measurement basis, in case for example the user provides [2 0; 0 1] as a measurement basis, or do we want to just trust the user to provide a properly normalized basis?