GateBase.evaluate() computes incorrect probabilities
Issue #9
resolved
In evaluate(), there is a line that caluculates the probability of each state in a superposition: probabilities = (output.full()**2).real
But this is wrong. It should be probabilities = (output.full()*output.full().conjugate()).real
In particular, S.evaluate(1) fails because it calculates the probability of |1> as -1.
Comments (4)
-
-
repo owner Thanks, I got your patch by the way. I'll have a look in a bit.
-
repo owner And FWIW this was definitely a known issue to me now that I think about it. Remember there being something not right about how probability amplitudes were represented internally. Thanks for making an issue for it since I apparently never did.
-
repo owner - edited description
- changed status to resolved
This is fixed now by f4893468d82b1e as well, which I forgot fixed this issue too.
- Log in to comment
For the record, that issue was by me.