Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.2k stars 2.36k forks source link

Add Schmidt Decomposition to `quantum_info` #10087

Closed diemilio closed 1 year ago

diemilio commented 1 year ago

What should we add?

Being able to get the Schmidt decomposition of a bipartate state can be useful to determine its degree of entanglement, find the shared eigenvalues of its reduced subsystems, and to compare if two states are equivalent to each other (i.e., they're equiv if they share the same decomposition). It would be great if there was a function under utils, or if the Statevector class had a method to do this for a given state.

The steps to implement should be fairly straight-forward:

  1. Reshape the statevector column-vector into a matrix C of dims of (first subsystem) x (second subsystem). (need to consider the case when indices of subsystem are not sequential).
  2. Calculate the SVD of that matrix C = UΣVᴴ.
  3. The columns of U are the Schmidt eigenvectors |uᵢ⟩ of the first subsystem, the columns of V the eigenvectors |vᵢ⟩ of the second subsystem, the diagonal elems of Σ are the Schmidt coeffs λᵢ.

The function could return a list/array with each (λᵢ, |uᵢ⟩, |vᵢ⟩). Since |uᵢ⟩ and |vᵢ⟩ are normalized statevectors, they could be Statevector objects.

diemilio commented 1 year ago

I'm willing to work on it if there is interest.

ikkoham commented 1 year ago

Thank you for your nice proposal. I agree with this direction. I think that utils is fine. If you open the PR, I'll review it and if you have questions please contact me.

diemilio commented 1 year ago

Thank you so much @ikkoham. I have had a working function for a little while now, so I thought integrating it into qiskit wouldn't be too difficult. However, I started looking into this yesterday and realized I still need a couple of things:

I am currently working on getting these fixed and will submit a PR right after. I will also let you know if I have any questions.

Thanks!

ikkoham commented 1 year ago

Thanks. Yes Qiskit is a little endian, that is the reverse order of usual textbook.

diemilio commented 1 year ago

Completed in #10104