RosettaCodeData/Task/Conjugate-transpose/Mathematica/conjugate-transpose.math

18 lines
369 B
Plaintext

NormalMatrixQ[a_List?MatrixQ] := Module[{b = Conjugate@Transpose@a},a.b === b.a]
UnitaryQ[m_List?MatrixQ] := (Conjugate@Transpose@m.m == IdentityMatrix@Length@m)
m = {{1, 2I, 3}, {3+4I, 5, I}};
m //MatrixForm
->
(1 2I 3
3+4I 5 I)
ConjugateTranspose[m] //MatrixForm
->
(1 3-4I
-2I 5
3 -I)
{HermitianMatrixQ@#, NormalMatrixQ@#, UnitaryQ@#}&@m
-> {False, False, False}