X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=587d8e339463adaafb0a390ec164e76a6e5ca0c4;hb=cf5e64b70869df65c7bb38888de54b1083e60d45;hp=4ee5aba352bf870b679e8c782559c53e2db579ad;hpb=ebb0595a1c30afe9690d081672d8dfc88e90af74;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 4ee5aba..587d8e3 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,15 @@ 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) + super().__init__(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()) ) + if n == 3: + from mjo.eja.eja_cache import albert_eja_coeffs + a = albert_eja_coeffs(self.coordinate_polynomial_ring()) + if self._rational_algebra is None: + self._charpoly_coefficients.set_cache(a) + else: + self._rational_algebra._charpoly_coefficients.set_cache(a) class AlbertEJA(OctonionHermitianEJA):