For square empty arrays the result is returned True by convention.
:None:None:`numpy.inf`
will be treated as a number, that is to say[[1, inf], [inf, 2]]
will returnTrue
. On the other hand:None:None:`numpy.NaN`
is never symmetric, say,[[1, nan], [nan, 2]]
will returnFalse
.When
atol
and/orrtol
are set to , then the comparison is performed bynumpy.allclose
and the tolerance values are passed to it. Otherwise an exact comparison against zero is performed by internal functions. Hence performance can improve or degrade depending on the size and dtype of the array. If one ofatol
orrtol
given the other one is automatically set to zero.
Input array of size (N, N)
Absolute error bound
Relative error bound
If the dtype of the array is not supported, in particular, NumPy float16, float128 and complex256 dtypes.
Returns True if the array Hermitian.
ishermitian(a, atol=None, rtol=None) Check if a square 2D array is Hermitian.
issymmetric
Check if a square 2D array is symmetric
See :>>> from scipy.linalg import ishermitian >>> A = np.arange(9).reshape(3, 3) >>> A = A + A.T >>> ishermitian(A) True >>> A = np.array([[1., 2. + 3.j], [2. - 3.j, 4.]]) >>> ishermitian(A) True >>> Ac = np.array([[1. + 1.j, 3.j], [3.j, 2.]]) >>> ishermitian(Ac) # not Hermitian but symmetric False >>> Af = np.array([[0, 1 + 1j], [1 - (1+1e-12)*1j, 0]]) >>> ishermitian(Af) False >>> ishermitian(Af, atol=5e-11) # almost hermitian with atol True
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.linalg._cythonized_array_utils.issymmetric
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them