-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems in the implementation of Density matrix. #25980
Comments
Other than that also evaluating the partial trace over a Density matrix gets a wrong result (even assuming the wrong matrix): rho = Density([state, 1])
q.represent(rho) Partial trace calculates: q.represent(Tr(rho, [0]).doit()) But instead we should get: |
This pull request addresses the issue sympy#25980 Where the calculation of density matrix using the density class was incorrect hence the code for returning the correct answer is implemented in this PR.
Thanks a lot @amishhaa for the PR, for this other problem I create another issue? |
@alex180500 I think it's best to create another issue so it comes to attention faster and can be fixed ASAP. |
In
Density.doit()
there is a mistake for the_generate_outer_prod()
method when returningreturn Mul(*c_part1)*Mul(*c_part2) * op
. The commutative part 2 should be the complex conjugate, so the return should bereturn Mul(*c_part1)*conjugate(Mul(*c_part2))*op
.Example:
What should be the density matrix:
What the density matrix is using the
Density
class:The text was updated successfully, but these errors were encountered: