ishermitian

Tests whether a matrix is Hermitian or skew-Hermitian.

Category: Mathematics > Linear Algebra

Syntax

tf = ishermitian(A)

True if A equals its conjugate transpose A'.

tf = ishermitian(A, 'skew')

True if A equals -A'.

tf = ishermitian(A, tol)

Accepts a relative difference up to the tolerance tol.

Description

For a real matrix, Hermitian means symmetric. A Hermitian matrix has real diagonal and real eigenvalues. The default test is exact, so matrices that are symmetric only up to rounding need a tolerance.

Input arguments

A
Numeric square matrix.
tol
Non-negative tolerance; the default is 0 (exact comparison).

Output arguments

tf
Logical scalar.

Example

Complex Hermitian and a tolerance

ishermitian([1 2i; -2i 3])
ishermitian([1 2; 3 4])
ishermitian([1 2; 2.001 4])
ishermitian([1 2; 2.001 4], 0.01)
Output
ans = logical
   1
ans = logical
   0
ans = logical
   0
ans = logical
   0

See also

issymmetric ctranspose isdiag eig