openfermion.linalg.givens_decomposition

Decompose a matrix into a sequence of Givens rotations.

The input is an :math:m \times n matrix :math:Q with :math:m \leq n. The rows of :math:Q are orthonormal. :math:Q can be decomposed as follows:

.. math::

V Q U^\dagger = D

where :math:V and :math:U are unitary matrices, and :math:D is an :math:m \times n matrix with the first :math:m columns forming a diagonal matrix and the rest of the columns being zero. Furthermore, we can decompose :math:U as

.. math::

U = G_k ... G_1

where :math: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

.. math::

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

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

Returns

givens_rotations (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 :math:`(i, j, \theta, \varphi)`, which represents a
    Givens rotation of coordinates
    :math:`i` and :math:`j` by angles :math:`\theta` and
    :math:`\varphi`.
left_unitary (ndarray):
    An :math:`m \times m` numpy array representing the matrix
    :math:`V`.
diagonal (ndarray):
    A list of the nonzero entries of :math:`D`.