X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fhurwitz.py;h=1f7c9dc3781a844d6d77a1e63168c52340bf6770;hb=fc29add6cf1d9ff4e8a240b0f8f2ca6672d4ea57;hp=a1a6af06e944e97ea49536b8b9f76e1ecf54cde6;hpb=37ab2f97b6f8b64360045a1db4c74b6c38651317;p=sage.d.git diff --git a/mjo/hurwitz.py b/mjo/hurwitz.py index a1a6af0..1f7c9dc 100644 --- a/mjo/hurwitz.py +++ b/mjo/hurwitz.py @@ -306,6 +306,31 @@ class Octonions(CombinatorialFreeModule): class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): + def conjugate_transpose(self): + r""" + Return the conjugate-transpose of this matrix. + + SETUP:: + + sage: from mjo.hurwitz import HurwitzMatrixAlgebra + + EXAMPLES:: + + sage: A = HurwitzMatrixAlgebra(2, QQbar, ZZ) + sage: M = A([ [ I, 2*I], + ....: [ 3*I, 4*I] ]) + +------+------+ + | -1*I | -3*I | + +------+------+ + | -2*I | -4*I | + +------+------+ + + """ + entries = [ [ self[j,i].conjugate() + for j in range(self.ncols())] + for i in range(self.nrows()) ] + return self.parent()._element_constructor_(entries) + def is_hermitian(self): r""" @@ -322,6 +347,8 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): True """ + # A tiny bit faster than checking equality with the conjugate + # transpose. return all( self[i,j] == self[j,i].conjugate() for i in range(self.nrows()) for j in range(self.ncols()) ) @@ -440,6 +467,31 @@ class OctonionMatrixAlgebra(HurwitzMatrixAlgebra): +---------------------+ | 1.00000000000000*e0 | +---------------------+ + sage: A.gens() + (+---------------------+ + | 1.00000000000000*e0 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e1 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e2 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e3 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e4 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e5 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e6 | + +---------------------+, + +---------------------+ + | 1.00000000000000*e7 | + +---------------------+) :: @@ -519,6 +571,19 @@ class QuaternionMatrixAlgebra(HurwitzMatrixAlgebra): +-----+ | 1.0 | +-----+ + sage: A.gens() + (+-----+ + | 1.0 | + +-----+, + +---+ + | i | + +---+, + +---+ + | j | + +---+, + +---+ + | k | + +---+) :: @@ -598,6 +663,13 @@ class ComplexMatrixAlgebra(HurwitzMatrixAlgebra): +------------------+ | 1.00000000000000 | +------------------+ + sage: A.gens() + (+------------------+ + | 1.00000000000000 | + +------------------+, + +--------------------+ + | 1.00000000000000*I | + +--------------------+) ::