toqito.matrix_props.is_rank_one =============================== .. py:module:: toqito.matrix_props.is_rank_one .. autoapi-nested-parse:: Checks if a matrix has rank one. Module Contents --------------- .. py:function:: is_rank_one(mat, tol = 1e-08) Determine whether the given matrix has rank one [@WikiMatrixRank]. The function evaluates the singular values (equivalently, eigenvalues for Hermitian matrices) and counts how many are greater than the provided tolerance. .. rubric:: Examples Consider the Bell state density matrix \(\rho = \ket{\Phi^+}\bra{\Phi^+}\). This matrix has rank one. ```python exec="1" source="above" from toqito.matrix_props import is_rank_one from toqito.states import bell rho = bell(0) @ bell(0).conj().T print(is_rank_one(rho)) ``` On the other hand, the maximally mixed state is not rank one. ```python exec="1" source="above" import numpy as np from toqito.matrix_props import is_rank_one maximally_mixed = np.eye(2) / 2 print(is_rank_one(maximally_mixed)) ``` :param mat: Matrix to test. :param tol: Numerical tolerance used when distinguishing non-zero singular values. :returns: `True` if the matrix has rank at most one, `False` otherwise.