2.68 Check if a matrix is Hermite

Problem: Given a matrix A, check to see if it is Hermite.

A Matrix is Hermite if it is the same as the conjugate of its transpose. One way to check is to take the difference and check that all values in the resulting difference matrix are zero.

To account for numerical values, the check is done using machine epsilon.

Mathematica

mat = {{-1,1-3*I,0}, 
       {1+3*I,0,-6*I}, 
       {0,6*I,1}}; 
HermitianMatrixQ[mat]
 

True

 

Matlab

clear all; 
i=sqrt(-1); 
mat=[-1     1-3*i    0; 
    1+3*i    0      -6*i; 
      0      6*i     1]; 
 
mat2=conj(transpose(mat)); 
diff = mat-mat2
 

diff = 
     0     0     0 
     0     0     0 
     0     0     0
 

r=abs(diff)<eps('double')
 

r = 
     1     1     1 
     1     1     1 
     1     1     1
 

all(r(:))
 

1

 

Maple

mat := Matrix([[-1,1-3*I,0], [1+3*I,0,-6*I],[0,6*I,1]]); 
mat2:= LinearAlgebra:-HermitianTranspose(mat); 
LinearAlgebra:-Equal(mat,mat2)
 

true