Conjugate transpose: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: whitespace tweaks) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: minor style tweaks) |
||
Line 1,120: | Line 1,120: | ||
say "\nTranspose:"; |
say "\nTranspose:"; |
||
@t.&say-it; |
@t.&say-it; |
||
say "Is Hermitian? |
say "Is Hermitian?\t{is-Hermitian(@m, @t)}"; |
||
say "Is Normal? |
say "Is Normal?\t{is-Normal(@m, @t)}"; |
||
say "Is Unitary? |
say "Is Unitary?\t{is-Unitary(@m, @t)}"; |
||
} |
} |
||
Line 1,130: | Line 1,130: | ||
sub is-Normal (@m, @t, --> Bool) { |
sub is-Normal (@m, @t, --> Bool) { |
||
mat-mult(@m, @t)».Complex eqv mat-mult(@t, @m)».Complex |
so mat-mult(@m, @t)».Complex eqv mat-mult(@t, @m)».Complex |
||
} |
} |
||
Line 1,147: | Line 1,147: | ||
@p[$r][$c].=round(ε); # avoid floating point math errors |
@p[$r][$c].=round(ε); # avoid floating point math errors |
||
} |
} |
||
@p |
@p |
||
} |
} |
||
Line 1,161: | Line 1,161: | ||
[ 1-1i 5 -3] |
[ 1-1i 5 -3] |
||
[ 0-2i -3 0] |
[ 0-2i -3 0] |
||
Is Hermitian? |
Is Hermitian? True |
||
Is Normal? |
Is Normal? True |
||
Is Unitary? |
Is Unitary? False |
||
Matrix: |
Matrix: |
||
Line 1,174: | Line 1,174: | ||
[ 1 1 0] |
[ 1 1 0] |
||
[ 0 1 1] |
[ 0 1 1] |
||
Is Hermitian? |
Is Hermitian? False |
||
Is Normal? |
Is Normal? True |
||
Is Unitary? |
Is Unitary? False |
||
Matrix: |
Matrix: |
||
Line 1,187: | Line 1,187: | ||
[ 0.707 0+0.707i 0] |
[ 0.707 0+0.707i 0] |
||
[ 0 0 0-1i] |
[ 0 0 0-1i] |
||
Is Hermitian? |
Is Hermitian? False |
||
Is Normal? |
Is Normal? True |
||
Is Unitary? |
Is Unitary? True |
||
</pre> |
</pre> |
||