nws_tools.issym

nws_tools.issym(A, tol=1e-09)[source]

Check for symmetry of a 2d NumPy array

Parameters:

A : NumPy 2darray

A presumably symmetric matrix

tol : float

Tolerance \(\tau\) for checking if \(A\) is sufficiently close to \(A^\top\).

Returns:

is_sym : bool

True if \(A\) satisfies \(|A - A^\top| \leq \tau |A|\), where \(|\cdot|\) denotes the Frobenius norm. Thus, if this inequality holds, \(A\) is approximately symmetric.

See also

isclose
An absolute-value based comparison readily provided by NumPy.

Notes

For further details regarding the Frobenius norm approach used, please refer to the discussion in this thread at MATLAB central