matrix_props.is_totally_positive

Is matrix totally positive.

Module Contents

Functions

is_totally_positive(mat[, tol, sub_sizes])

Determine whether a matrix is totally positive. [1].

matrix_props.is_totally_positive.is_totally_positive(mat, tol=1e-06, sub_sizes=None)

Determine whether a matrix is totally positive. [1].

A totally positive matrix is a square matrix where all the minors are positive. Equivalently, the determinant of every square submatrix is a positive number.

Examples

Consider the matrix

\[\begin{split}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\end{split}\]

To determine if this matrix is totally positive, we need to check the positivity of all of its minors. The 1x1 minors are simply the individual entries of the matrix. For \(X\), these are

\[\begin{split}\begin{equation} \begin{aligned} X_{1,1} &= 1 \\ X_{1,2} &= 2 \\ X_{2,1} &= 3 \\ X_{2,2} &= 4 \\ \end{aligned} \end{equation}\end{split}\]

Each of these entries is positive. There is only one 2x2 minor in this case, which is the determinant of the entire matrix \(X\). The determinant of \(X\) is calculated as:

\[\text{det}(X) = 1 \times 4 - 2 \times 3 = 4 - 6 = 2\]

References

[1] (1,2)

Wikipedia. Totally positive matrix. https://en.wikipedia.org/wiki/Totally_positive_matrix.

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

  • tol (float) – The absolute tolerance parameter (default 1e-06).

  • sub_sizes (list | None) – List of sizes of submatrices to consider. Default is all sizes up to min(mat.shape).

Returns:

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