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.

import numpy as np
from toqito.matrix_props import is_positive_definite

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.

import numpy as np
from toqito.matrix_props import is_positive_definite

B = np.array([[-1, -1], [-1, -1]])

is_positive_definite(B)
False

References

Parameters:

mat (numpy.ndarray) – Matrix to check.

Returns:

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

Return type:

bool