We're celebrating World Quantum Day 2022! Join us

openfermion.linalg.givens_decomposition_square

Decompose a square matrix into a sequence of Givens rotations.

Used in the notebooks

Used in the tutorials

The input is a square \(n \times n\) matrix \(Q\). \(Q\) can be decomposed as follows:

\[ Q = DU \]

where \(U\) is unitary and \(D\) is diagonal. Furthermore, we can decompose \(U\) as

\[ U = G_k ... G_1 \]

where \(G_1, \ldots, G_k\) are complex Givens rotations. A Givens rotation is a rotation within the two-dimensional subspace spanned by two coordinate axes. Within the two relevant coordinate axes, a Givens rotation has the form

\[ \begin{pmatrix} \cos(\theta) & -e^{i \varphi} \sin(\theta) \\ \sin(\theta) & e^{i \varphi} \cos(\theta) \end{pmatrix}. \]

unitary_matrix A numpy array with orthonormal rows, representing the matrix Q.

Returns

decomposition (list[tuple]):
    A list of tuples of objects describing Givens
    rotations. The list looks like [(G_1, ), (G_2, G_3), ... ].
    The Givens rotations within a tuple can be implemented in parallel.
    The description of a Givens rotation is itself a tuple of the
    form \\((i, j, \theta, \varphi)\\), which represents a
    Givens rotation of coordinates
    \\(i\\) and \\(j\\) by angles \\(\theta\\) and
    \\(\varphi\\).
diagonal (ndarray):
    A list of the nonzero entries of \\(D\\).