X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=92a7df167a4596504c712cf2117e79568cf7eda9;hb=02bb28968221a0f077b49205e2746abd8c5450d9;hp=a5653a3e5e4e0fb0297d7a5ebefceff2b7ee75cc;hpb=a900f5daa84d0889ce7c1e041fb214a09e8d7bcd;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index a5653a3..92a7df1 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1,4 +1,4 @@ -""" +r""" Representations and constructions for Euclidean Jordan algebras. A Euclidean Jordan algebra is a Jordan algebra that has some @@ -1194,7 +1194,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: x = J.random_element() sage: J.one()*x == x and x*J.one() == x True - sage: A = x.subalgebra_generated_by() + sage: A = x.subalgebra_generated_by(orthonormalize=False) sage: y = A.random_element() sage: A.one()*y == y and y*A.one() == y True @@ -1220,7 +1220,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: actual == expected True sage: x = J.random_element() - sage: A = x.subalgebra_generated_by() + sage: A = x.subalgebra_generated_by(orthonormalize=False) sage: actual = A.one().operator().matrix() sage: expected = matrix.identity(A.base_ring(), A.dimension()) sage: actual == expected @@ -1800,14 +1800,13 @@ class RationalBasisEJA(FiniteDimensionalEJA): # Bypass the hijinks if they won't benefit us. return super()._charpoly_coefficients() - # Do the computation over the rationals. The answer will be - # the same, because all we've done is a change of basis. - # Then, change back from QQ to our real base ring + # Do the computation over the rationals. a = ( a_i.change_ring(self.base_ring()) for a_i in self.rational_algebra()._charpoly_coefficients() ) - # Otherwise, convert the coordinate variables back to the - # deorthonormalized ones. + # Convert our coordinate variables into deorthonormalized ones + # and substitute them into the deorthonormalized charpoly + # coefficients. R = self.coordinate_polynomial_ring() from sage.modules.free_module_element import vector X = vector(R, R.gens()) @@ -2188,15 +2187,6 @@ class ComplexHermitianEJA(HermitianMatrixEJA, RationalBasisEJA, ConcreteEJA): ... TypeError: Illegal initializer for algebraic number - This causes the following error when we try to scale a matrix of - complex numbers by an inexact real number:: - - sage: ComplexHermitianEJA(2,field=RR) - Traceback (most recent call last): - ... - TypeError: Unable to coerce entries (=(1.00000000000000, - -0.000000000000000)) to coefficients in Algebraic Real Field - TESTS: The dimension of this algebra is `n^2`:: @@ -3426,6 +3416,34 @@ class CartesianProductEJA(FiniteDimensionalEJA): return FiniteDimensionalEJAOperator(Ji,self,Ei.matrix()) + def subalgebra(self, basis, **kwargs): + r""" + Create a subalgebra of this algebra from the given basis. + + Only overridden to allow us to use a special Cartesian product + subalgebra class. + + SETUP:: + + sage: from mjo.eja.eja_algebra import (HadamardEJA, + ....: QuaternionHermitianEJA) + + EXAMPLES: + + Subalgebras of Cartesian product EJAs have a different class + than those of non-Cartesian-product EJAs:: + + sage: J1 = HadamardEJA(2,field=QQ,orthonormalize=False) + sage: J2 = QuaternionHermitianEJA(0,field=QQ,orthonormalize=False) + sage: J = cartesian_product([J1,J2]) + sage: K1 = J1.subalgebra((J1.one(),), orthonormalize=False) + sage: K = J.subalgebra((J.one(),), orthonormalize=False) + sage: K1.__class__ is K.__class__ + False + + """ + from mjo.eja.eja_subalgebra import FiniteDimensionalCartesianProductEJASubalgebra + return FiniteDimensionalCartesianProductEJASubalgebra(self, basis, **kwargs) FiniteDimensionalEJA.CartesianProduct = CartesianProductEJA