graphix.linalg_validations module

Validation functions for linear algebra.

is_square(matrix: NDArray[_T]) → bool[source]

Check if matrix is square.

is_qubitop(matrix: NDArray[_T]) → bool[source]

Check if matrix is a square matrix with a power of 2 dimension.

is_hermitian(matrix: NDArray[_T]) → bool[source]

Check if matrix is hermitian.

is_psd(matrix: NDArray[_T], tol: float = 1e-15) → bool[source]

Check if a density matrix is positive semidefinite by diagonalizing.

Parameters:
  • matrix (np.ndarray) – matrix to check

  • tol (float) – tolerance on the small negatives. Default 1e-15.

is_unit_trace(matrix: NDArray[_T]) → bool[source]

Check if matrix has trace 1.