matrix_props.is_positive_definite

Checks if the matrix is a positive definite matrix.

Functions

is_positive_definite(mat)

Check if matrix is positive definite (PD) [1].

Module Contents

matrix_props.is_positive_definite.is_positive_definite(mat)

Check if matrix is positive definite (PD) [1].

Examples

Consider the following matrix

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

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

>>> from toqito.matrix_props import is_positive_definite
>>> import numpy as np
>>> A = np.array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]])
>>> is_positive_definite(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 definite.

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

See also

is_positive_semidefinite

References

[1] (1,2)

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

Parameters:

mat (numpy.ndarray) – Matrix to check.

Returns:

Return True if matrix is positive definite, and False otherwise.

Return type:

bool