givens_decomposition

givens_decomposition(unitary)

Decomposes a unitary matrix into Givens rotations and diagonal phases.

The \(n \times n\) unitary matrix, \(U\), can be decomposed into a diagonal matrix, \(D\), and sequence of \(2 \times 2\) Givens rotations, \(G\), acting on adjacent indices. This algorithm [1] requires at most \(n (n-1) / 2\) such Givens rotations.

Each Givens rotation is defined by a 4-tuple, (c, s, i, j), with:

  • c: the real-valued cosine

  • s: the complex-valued sine

  • i: the first row index

  • j: the second row index

which result in a matrix of the form:

\[\begin{pmatrix} c & s \\ -s^\dagger & c \end{pmatrix}\]
Parameters:

unitary – the unitary matrix, \(U\), to be decomposed.

Returns:

A 2-tuple consisting of

  • the sequence of Givens rotations represented as 4-tuples as explained above

  • the vector of complex phases of the diagonal matrix, \(D\)