Jump to content

Conjugate transpose: Difference between revisions

(Updated D entry and added an alternative version)
Line 888:
<lang julia>isnormal(A) = size(A,1) == size(A,2) && A'*A == A*A'
isunitary(A) = size(A,1) == size(A,2) && A'*A == eye(A)</lang>
 
=={{header|Maple}}==
The commands <code>HermitianTranspose</code> and <code>IsUnitary</code> are provided by the <code>LinearAlgebra</code> package.
<lang Maple>M:=<<3|2+I>,<2-I|1>>:
 
with(LinearAlgebra):
IsNormal:=A->EqualEntries(A^%H.A,A.A^%H):
 
M^%H;
HermitianTranspose(M);
type(M,'Matrix'(hermitian));
IsNormal(M);
IsUnitary(M);</lang>
Output:
<pre> [ 3 2 + I]
[ ]
[2 - I 1 ]
 
[ 3 2 + I]
[ ]
[2 - I 1 ]
 
true
 
true
 
false</pre>
 
=={{header|Mathematica}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.