|View source on GitHub|
Decompose a matrix into a sequence of Givens rotations and
openfermion.linalg.fermionic_gaussian_decomposition( unitary_rows )
particle-hole transformations on the last fermionic mode.
The input is an $N \times 2N$ matrix $W$ with orthonormal rows. Furthermore, $W$ must have the block form
where $W_1$ and $W_2$ satisfy
W_1 W_2^T + W_2 W_1^T &= 0.
Then $W$ can be decomposed as
where $V$ and $U$ are unitary matrices and $D$ is a diagonal unitary matrix. Furthermore, $U$ can be decomposed as follows:
where each $G_i$ is a Givens rotation, and $B$ represents swapping the $N$-th column with the $2N$-th column, which corresponds to a particle-hole transformation on the last fermionic mode. This particle-hole transformation maps $a^\dagger_N$ to $a_N$ and vice versa, while leaving the other fermionic ladder operators invariant.
The decomposition of $U$ is returned as a list of tuples of objects describing rotations and particle-hole transformations. The list looks something like [('pht', ), (G_1, ), ('pht', G_2), ... ]. The objects within a tuple are either the string 'pht', which indicates a particle-hole transformation on the last fermionic mode, or a tuple of the form $(i, j, \theta, \varphi)$, which indicates a Givens rotation of rows $i$ and $j$ by angles $\theta$ and $\varphi$.
The matrix $V^T D^*$ can also be decomposed as a sequence of Givens rotations. This decomposition is needed for a circuit that prepares an excited state.
|unitary_rows(ndarray): A matrix with orthonormal rows and additional structure described above.|
decomposition (list[tuple]): The decomposition of $U$. left_decomposition (list[tuple]): The decomposition of $V^T D^*$. diagonal (ndarray): A list of the nonzero entries of $D$. left_diagonal (ndarray): A list of the nonzero entries left from the decomposition of $V^T D^*$.