X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fhurwitz.py;h=614804f21fb831aae04ff97be31413e84c1b61f8;hb=2c4fdb8c5b0d70b1aafb3aed7e993c5821ee26be;hp=43ed8f20782c074022a3a0f46f68c7dad00dae5f;hpb=3b8bb4b76e19f857da235759ca413a6ff8d48f71;p=sage.d.git diff --git a/mjo/hurwitz.py b/mjo/hurwitz.py index 43ed8f2..614804f 100644 --- a/mjo/hurwitz.py +++ b/mjo/hurwitz.py @@ -299,6 +299,32 @@ class Octonions(CombinatorialFreeModule): class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): + def conjugate(self): + r""" + Return the entrywise conjugate of this matrix. + + SETUP:: + + sage: from mjo.hurwitz import ComplexMatrixAlgebra + + EXAMPLES:: + + sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ) + sage: M = A([ [ I, 1 + 2*I], + ....: [ 3*I, 4*I] ]) + sage: M.conjugate() + +------+----------+ + | -I | -2*I + 1 | + +------+----------+ + | -3*I | -4*I | + +------+----------+ + + """ + entries = [ [ self[i,j].conjugate() + for j in range(self.ncols())] + for i in range(self.nrows()) ] + return self.parent()._element_constructor_(entries) + def conjugate_transpose(self): r""" Return the conjugate-transpose of this matrix. @@ -343,6 +369,14 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): sage: M.is_hermitian() True + :: + + sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ) + sage: M = A([ [ 0,0], + ....: [-I,0] ]) + sage: M.is_hermitian() + False + :: sage: A = HurwitzMatrixAlgebra(2, AA, QQ) @@ -356,11 +390,12 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): # transpose. return all( self[i,j] == self[j,i].conjugate() for i in range(self.nrows()) - for j in range(self.ncols()) ) + for j in range(i+1) ) - def is_skew_hermitian(self): + def is_skew_symmetric(self): r""" + Return whether or not this matrix is skew-symmetric. SETUP:: @@ -372,15 +407,23 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ) sage: M = A([ [ 0,I], ....: [-I,1] ]) - sage: M.is_skew_hermitian() + sage: M.is_skew_symmetric() False + :: + + sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ) + sage: M = A([ [ 0, 1+I], + ....: [-1-I, 0] ]) + sage: M.is_skew_symmetric() + True + :: sage: A = HurwitzMatrixAlgebra(2, AA, QQ) sage: M = A([ [1, 1], ....: [1, 1] ]) - sage: M.is_skew_hermitian() + sage: M.is_skew_symmetric() False :: @@ -388,15 +431,15 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement): sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ) sage: M = A([ [2*I , 1 + I], ....: [-1 + I, -2*I] ]) - sage: M.is_skew_hermitian() - True + sage: M.is_skew_symmetric() + False """ - # A tiny bit faster than checking equality with the conjugate - # transpose. - return all( self[i,j] == -self[j,i].conjugate() + # A tiny bit faster than checking equality with the negation + # of the transpose. + return all( self[i,j] == -self[j,i] for i in range(self.nrows()) - for j in range(self.ncols()) ) + for j in range(i+1) ) class HurwitzMatrixAlgebra(MatrixAlgebra):