Cirq icon indicating copy to clipboard operation
Cirq copied to clipboard

Schmidt decomposition

Open viathor opened this issue 6 years ago • 8 comments

A few interesting properties of a two-qubit gate can be determined from its Schmidt decomposition. The decomposition is similar to the Pauli expansion (computed by the pauli_expansion protocol). In general, a unitary can be expressed in any basis of the space of matrices. In Pauli expansion, we choose the basis that consists of Pauli products. In Schmidt decomposition, we choose the basis that minimizes the number of terms. For a two-qubit gate this means at most four terms (compare e.g. to the Pauli expansion of the fSim gate which has six terms). This "optimality" of the decomposition w.r.t. the number of terms is what makes Schmidt decomposition interesting. It is for example related to the cost of simulation (see e.g. this paper). Also, the number of non-zero terms in the decomposition (called the Schmidt rank of the gate) provides a way of quantifying the amount of entanglement introduced by the gate into a product input state.

This issue proposes a new protocol similar to pauli_expansion, but for the computation of the Schmidt decomposition of two-qubit gates. Note that a lot of linear algebra code behind the pauli_expansion protocol is basis-independent and can be re-used. We just need new code to find the right basis.

viathor avatar Jul 26 '19 17:07 viathor

Like should be a protocol, especially because it also applies pure states.

dabacon avatar Jul 29 '19 17:07 dabacon

Can I take a shot at this ?

iamvamsikrishnad avatar Aug 01 '19 09:08 iamvamsikrishnad

@iamvamsikrishnad Generally, yes, help is very welcome! Note that I filed this early to record a need which I encountered when playing with some problems in cirq. This issue is actually gated on having a representation for tensor products suitable for specifying the operators that make up the Schmidt decomposition. AFAIK, we don't yet have anything appropriate in cirq. I'll ping this again when we have something.

viathor avatar Aug 02 '19 00:08 viathor

@viathor : Sure !

iamvamsikrishnad avatar Aug 02 '19 05:08 iamvamsikrishnad

Hi Adam, If I understand problem correctly, it can be solved with help of KAK decomposition, which is already implemented in Cirq.

Here is my implementation: https://github.com/fedimser/quant_comp/blob/master/Schmidt%20decomposition%20of%204x4%20matrix.ipynb

If it's correct, I would like to implement it in Cirq.

CC: @viathor @iamvamsikrishnad

fedimser avatar Dec 25 '19 23:12 fedimser

There are a few ways to compute Schmidt decomposition. Your implementation of the computational aspect of it looks good to me, but let's hold off on this until we have a good representation in which the output can be returned. The representation is WIP. I'll ping this issue when it's ready.

viathor avatar Jan 15 '20 21:01 viathor

#3171 will be useful for this if not completely ready to unblock? What do you think @viathor?

balopat avatar Sep 15 '20 22:09 balopat

Agreed.

This issue has been gated on having a good representation for tensor products. As @dabacon pointed out above, the new protocol should be able to compute Schmidt decomposition of both pure states and unitary gates. #3171 gives us a good way to represent tensor products of pure states, so we can go ahead and implement Schmidt decomposition on pure states. The other half - Schmidt decomposition for operators - is still gated on having a representation for tensor products of gates.

viathor avatar Sep 16 '20 01:09 viathor

No one has asked for this issue in over 5 years. Closing this as stale.

Please re-open if you feel strongly about implementing this and explain what the use case is.

dstrain115 avatar Aug 13 '25 16:08 dstrain115