matrix_props.is_diagonally_dominant

Is matrix diagonally dominant.

Module Contents

Functions

is_diagonally_dominant(mat[, is_strict])

Check if matrix is diagnal dominant (DD) [1].

matrix_props.is_diagonally_dominant.is_diagonally_dominant(mat, is_strict=True)

Check if matrix is diagnal dominant (DD) [1].

A matrix is diagonally dominant if the matrix is square and if for every row of the matrix, the magnitude of the diagonal entry in a row is greater than or equal to the sum of the magnitudes of all the other (non-diagonal) entries in that row.

Examples

The following is an example of a 3-by-3 diagonal matrix:

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

our function indicates that this is indeed a diagonally dominant matrix.

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

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

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

is not diagonally dominant.

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

References

[1] (1,2)

Wikipedia. Diagonally dominant matrix. https://en.wikipedia.org/wiki/Diagonally_dominant_matrix.

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

  • is_strict (bool) – Whether the inequality is strict.

Returns:

Return True if matrix is diagnally dominant, and False otherwise.

Return type:

bool