matrix_props.is_positive_semidefinite

Checks if the matrix is a positive semidefinite matrix.

Functions

is_positive_semidefinite(mat[, rtol, atol])

Check if matrix is positive semidefinite (PSD) [1].

Module Contents

matrix_props.is_positive_semidefinite.is_positive_semidefinite(mat, rtol=1e-05, atol=1e-08)

Check if matrix is positive semidefinite (PSD) [1].

Examples

Consider the following matrix

\[\begin{split}A = \begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}\end{split}\]

our function indicates that this is indeed a positive semidefinite matrix.

>>> from toqito.matrix_props import is_positive_semidefinite
>>> import numpy as np
>>> A = np.array([[1, -1], [-1, 1]])
>>> is_positive_semidefinite(A)
True

Alternatively, the following example matrix \(B\) defined as

\[\begin{split}B = \begin{pmatrix} -1 & -1 \\ -1 & -1 \end{pmatrix}\end{split}\]

is not positive semidefinite.

>>> from toqito.matrix_props import is_positive_semidefinite
>>> import numpy as np
>>> B = np.array([[-1, -1], [-1, -1]])
>>> is_positive_semidefinite(B)
False

References

[1] (1,2)

Wikipedia. Definite matrix. URL: https://en.wikipedia.org/wiki/Definite_matrix.

Parameters:
  • mat (numpy.ndarray) – Matrix to check.

  • rtol (float) – The relative tolerance parameter (default 1e-05).

  • atol (float) – The absolute tolerance parameter (default 1e-08).

Returns:

Return True if matrix is PSD, and False otherwise.

Return type:

bool