matrix_props.positive_semidefinite_rank

Calculates the positive semidefinite rank of a nonnegative matrix.

Functions

positive_semidefinite_rank(mat[, max_rank])

Compute the positive semidefinite rank (PSD rank) of a nonnegative matrix.

_check_psd_rank(mat, max_rank)

Check if the given PSD rank k is feasible for matrix M.

Module Contents

matrix_props.positive_semidefinite_rank.positive_semidefinite_rank(mat, max_rank=10)

Compute the positive semidefinite rank (PSD rank) of a nonnegative matrix.

The definition of PSD rank is defined in [1].

Finds the PSD rank of an input matrix by checking feasibility for increasing rank.

Examples

As an example (Equation 21 from [2]), the PSD rank of the following matrix

\[\begin{split}A = \frac{1}{2} \begin{pmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{pmatrix}\end{split}\]

is known to be \(\text{rank}_{\text{PSD}}(A) = 2\).

import numpy as np
from toqito.matrix_props import positive_semidefinite_rank

positive_semidefinite_rank(1/2 * np.array([[0, 1, 1], [1,0,1], [1,1,0]]))
2

The PSD rank of the identity matrix is the dimension of the matrix [1].

import numpy as np
from toqito.matrix_props import positive_semidefinite_rank

positive_semidefinite_rank(np.identity(3))
3

References

Parameters:
  • mat (numpy.ndarray) – 2D numpy ndarray.

  • max_rank (int) – The maximum rank to check.

Returns:

The PSD rank of the input matrix, or None if not found within max_rank.

Return type:

int | None

matrix_props.positive_semidefinite_rank._check_psd_rank(mat, max_rank)

Check if the given PSD rank k is feasible for matrix M.

Parameters:
  • mat (numpy.ndarray) – 2D numpy ndarray

  • max_rank (int) – The maximum rank to check.

Returns:

True if max_rank is a feasible PSD rank, False otherwise.

Return type:

bool