X-Git-Url: http://gitweb.michael.orlitzky.com/?p=sage.d.git;a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=b2891e577e9aa0c5e36b64b6a537807e9330d0e6;hp=4ee5aba352bf870b679e8c782559c53e2db579ad;hb=bc02bf48592e22d034310cfffef8fb2a062c0a43;hpb=1bbade9f41ffbfe366b15d0db657f666bc1f025d diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 4ee5aba..b2891e5 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1746,7 +1746,7 @@ class ConcreteEJA(FiniteDimensionalEJA): return eja_class.random_instance(*args, **kwargs) -class MatrixEJA: +class MatrixEJA(FiniteDimensionalEJA): @staticmethod def _denormalized_basis(A): """ @@ -1887,8 +1887,23 @@ class MatrixEJA: return tr.real() + def __init__(self, matrix_space, **kwargs): + # We know this is a valid EJA, but will double-check + # if the user passes check_axioms=True. + if "check_axioms" not in kwargs: kwargs["check_axioms"] = False + + + super().__init__(self._denormalized_basis(matrix_space), + self.jordan_product, + self.trace_inner_product, + field=matrix_space.base_ring(), + matrix_space=matrix_space, + **kwargs) + + self.rank.set_cache(matrix_space.nrows()) + self.one.set_cache( self(matrix_space.one()) ) -class RealSymmetricEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): +class RealSymmetricEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA): """ The rank-n simple EJA consisting of real symmetric n-by-n matrices, the usual symmetric Jordan product, and the trace inner @@ -1971,22 +1986,11 @@ class RealSymmetricEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): if "check_axioms" not in kwargs: kwargs["check_axioms"] = False A = MatrixSpace(field, n) - super().__init__(self._denormalized_basis(A), - self.jordan_product, - self.trace_inner_product, - field=field, - matrix_space=A, - **kwargs) - - # TODO: this could be factored out somehow, but is left here - # because the MatrixEJA is not presently a subclass of the - # FDEJA class that defines rank() and one(). - self.rank.set_cache(n) - self.one.set_cache( self(A.one()) ) + super().__init__(A, **kwargs) -class ComplexHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): +class ComplexHermitianEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA): """ The rank-n simple EJA consisting of complex Hermitian n-by-n matrices over the real numbers, the usual symmetric Jordan product, @@ -2064,18 +2068,7 @@ class ComplexHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): from mjo.hurwitz import ComplexMatrixAlgebra A = ComplexMatrixAlgebra(n, scalars=field) - super().__init__(self._denormalized_basis(A), - self.jordan_product, - self.trace_inner_product, - field=field, - matrix_space=A, - **kwargs) - - # TODO: this could be factored out somehow, but is left here - # because the MatrixEJA is not presently a subclass of the - # FDEJA class that defines rank() and one(). - self.rank.set_cache(n) - self.one.set_cache( self(A.one()) ) + super().__init__(A, **kwargs) @staticmethod @@ -2091,7 +2084,7 @@ class ComplexHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): return cls(n, **kwargs) -class QuaternionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): +class QuaternionHermitianEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA): r""" The rank-n simple EJA consisting of self-adjoint n-by-n quaternion matrices, the usual symmetric Jordan product, and the @@ -2155,18 +2148,7 @@ class QuaternionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): from mjo.hurwitz import QuaternionMatrixAlgebra A = QuaternionMatrixAlgebra(n, scalars=field) - super().__init__(self._denormalized_basis(A), - self.jordan_product, - self.trace_inner_product, - field=field, - matrix_space=A, - **kwargs) - - # TODO: this could be factored out somehow, but is left here - # because the MatrixEJA is not presently a subclass of the - # FDEJA class that defines rank() and one(). - self.rank.set_cache(n) - self.one.set_cache( self(A.one()) ) + super().__init__(A, **kwargs) @staticmethod @@ -2184,7 +2166,7 @@ class QuaternionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): n = ZZ.random_element(cls._max_random_instance_size() + 1) return cls(n, **kwargs) -class OctonionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): +class OctonionHermitianEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA): r""" SETUP:: @@ -2297,18 +2279,7 @@ class OctonionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA): from mjo.hurwitz import OctonionMatrixAlgebra A = OctonionMatrixAlgebra(n, scalars=field) - super().__init__(self._denormalized_basis(A), - self.jordan_product, - self.trace_inner_product, - field=field, - matrix_space=A, - **kwargs) - - # TODO: this could be factored out somehow, but is left here - # because the MatrixEJA is not presently a subclass of the - # FDEJA class that defines rank() and one(). - self.rank.set_cache(n) - self.one.set_cache( self(A.one()) ) + super().__init__(A, **kwargs) class AlbertEJA(OctonionHermitianEJA):