GateBase.evaluate() computes incorrect probabilities

Issue #9 resolved
Former user created an issue

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)

  1. E. Madison Bray 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.

  2. Log in to comment