Gates Utils Module

This module contains utility functions to check if a matrix is special, orthogonal, unitary or Hermitian.

These functions are used to check the Lie group of a matrix and to select the appropriate decomposition to perform.

The module contains the following functions:

is_special(): Check if a matrix is special.
is_orthogonal(): Check if a matrix is orthogonal.
is_unitary(): Check if a matrix is unitary.
is_hermitian(): Check if a matrix is Hermitian.
qdecomp.utils.gates_utils.is_special(matrix: ndarray[tuple[Any, ...], dtype[floating]]) bool[source]

Check if a matrix is special, i.e., if its determinant is 1.

Parameters:

matrix (NDArray[float]) – Matrix to check.

Returns:

True if the matrix is special, False otherwise.

Return type:

bool

qdecomp.utils.gates_utils.is_orthogonal(matrix: ndarray[tuple[Any, ...], dtype[floating]]) bool[source]

Check if a matrix is orthogonal, i.e., if its inverse is equal to its transpose.

Parameters:

matrix (NDArray[float]) – Matrix to check.

Returns:

True if the matrix is orthogonal, False otherwise.

Return type:

bool

qdecomp.utils.gates_utils.is_unitary(matrix: ndarray[tuple[Any, ...], dtype[floating]]) bool[source]

Check if a matrix is unitary, i.e., if its inverse is equal to its conjugate transpose.

Parameters:

matrix (NDArray[float]) – Matrix to check.

Returns:

True if the matrix is unitary, False otherwise.

Return type:

bool

qdecomp.utils.gates_utils.is_hermitian(matrix: ndarray[tuple[Any, ...], dtype[floating]]) bool[source]

Check if a matrix is Hermitian, i.e., if it is equal to its conjugate transpose.

Parameters:

matrix (NDArray[float]) – Matrix to check.

Returns:

True if the matrix is Hermitian, False otherwise.

Return type:

bool