Conjugate transpose: Difference between revisions
Content added Content deleted
(Go solution) |
|||
Line 192: | Line 192: | ||
+--------+-----+--------------------------+ |
+--------+-----+--------------------------+ |
||
NB. In J, PjQ is P + Q*i and the 0.7071... is sqrt(2)</lang> |
NB. In J, PjQ is P + Q*i and the 0.7071... is sqrt(2)</lang> |
||
=={{header|Mathematica}}== |
|||
<lang Mathematica>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}</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |