RosettaCodeData/Task/Conjugate-transpose/Factor/conjugate-transpose.factor
2015-02-20 09:02:09 -05:00

14 lines
381 B
Factor

USING: kernel math.functions math.matrices sequences ;
IN: rosetta.hermitian
: conj-t ( matrix -- conjugate-transpose )
flip [ [ conjugate ] map ] map ;
: hermitian-matrix? ( matrix -- ? )
dup conj-t = ;
: normal-matrix? ( matrix -- ? )
dup conj-t [ m. ] [ swap m. ] 2bi = ;
: unitary-matrix? ( matrix -- ? )
[ dup conj-t m. ] [ length identity-matrix ] bi = ;