Main Content

ishermitian

Determine if matrix is Hermitian or skew-Hermitian

Description

tf = ishermitian(A) returns logical 1 (true) if A is a Hermitian matrix. Otherwise, it returns logical 0 (false).

example

tf = ishermitian(A,skewOption) specifies the type of the test. Specify skewOption as "skew" to determine if A is skew-Hermitian.

example

Examples

collapse all

Create a 3-by-3 matrix.

A = [1 0 1i; 0 1 0; 1i 0 1]
A = 3×3 complex

   1.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 1.0000i
   0.0000 + 0.0000i   1.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 1.0000i   0.0000 + 0.0000i   1.0000 + 0.0000i

The matrix is symmetric with respect to its real-valued diagonal.

Test if the matrix is Hermitian.

tf = ishermitian(A)
tf = logical
   0

The matrix A is not Hermitian because it is equal to its transpose, A.', but not its complex conjugate transpose, A'.

Change the element in A(3,1) to -1i.

A(3,1) = -1i;

Test if the modified matrix is Hermitian.

tf = ishermitian(A)
tf = logical
   1

The matrix A is now Hermitian because it is equal to its complex conjugate transpose, A'.

Create a 3-by-3 matrix.

A = [-1i -1 1-i;1 -1i -1;-1-i 1 -1i]
A = 3×3 complex

   0.0000 - 1.0000i  -1.0000 + 0.0000i   1.0000 - 1.0000i
   1.0000 + 0.0000i   0.0000 - 1.0000i  -1.0000 + 0.0000i
  -1.0000 - 1.0000i   1.0000 + 0.0000i   0.0000 - 1.0000i

The matrix has pure imaginary numbers on the main diagonal.

Test if the matrix is skew-Hermitian by specifying the test type as "skew".

tf = ishermitian(A,"skew")
tf = logical
   1

The matrix A is skew-Hermitian because it is equal to the negation of its complex conjugate transpose, -A'.

Input Arguments

collapse all

Input array. If A is not a square matrix, then ishermitian returns logical 0 (false).

Data Types: single | double | logical
Complex Number Support: Yes

Test type, specified as "nonskew" or "skew". Specify "skew" to test if A is skew-Hermitian.

More About

collapse all

Extended Capabilities

expand all

Version History

Introduced in R2014a

expand all