X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=ca3df5fea55949225a51f8255a2c13a33c37d9f2;hb=7f55521ab4652d3ca10cd085f8e9d41bf149e8e5;hp=43f8021706fdeaa20033043ae31d808b00bc007a;hpb=f8a4f27fc914955d6dd38108f7cdebbdc2103a8d;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 43f8021..ca3df5f 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -36,17 +36,21 @@ for these simple algebras: In addition to these, we provide two other example constructions, + * :class:`JordanSpinEJA` * :class:`HadamardEJA` + * :class:`AlbertEJA` * :class:`TrivialEJA` The Jordan spin algebra is a bilinear form algebra where the bilinear form is the identity. The Hadamard EJA is simply a Cartesian product -of one-dimensional spin algebras. And last but least, the trivial EJA -is exactly what you think it is; it could also be obtained by -constructing a dimension-zero instance of any of the other -algebras. Cartesian products of these are also supported using the -usual ``cartesian_product()`` function; as a result, we support (up to -isomorphism) all Euclidean Jordan algebras. +of one-dimensional spin algebras. The Albert EJA is simply a special +case of the :class:`OctonionHermitianEJA` where the matrices are +three-by-three and the resulting space has dimension 27. And +last/least, the trivial EJA is exactly what you think it is; it could +also be obtained by constructing a dimension-zero instance of any of +the other algebras. Cartesian products of these are also supported +using the usual ``cartesian_product()`` function; as a result, we +support (up to isomorphism) all Euclidean Jordan algebras. SETUP:: @@ -58,8 +62,6 @@ EXAMPLES:: Euclidean Jordan algebra of dimension... """ -from itertools import repeat - from sage.algebras.quatalg.quaternion_algebra import QuaternionAlgebra from sage.categories.magmatic_algebras import MagmaticAlgebras from sage.categories.sets_cat import cartesian_product @@ -1542,7 +1544,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): class RationalBasisEJA(FiniteDimensionalEJA): r""" - New class for algebras whose supplied basis elements have all rational entries. + Algebras whose supplied basis elements have all rational entries. SETUP:: @@ -2584,7 +2586,7 @@ class QuaternionHermitianEJA(ConcreteEJA, n = ZZ.random_element(cls._max_random_instance_size() + 1) return cls(n, **kwargs) -class OctonionHermitianEJA(FiniteDimensionalEJA, MatrixEJA): +class OctonionHermitianEJA(ConcreteEJA, MatrixEJA): r""" SETUP:: @@ -2667,7 +2669,23 @@ class OctonionHermitianEJA(FiniteDimensionalEJA, MatrixEJA): sage: J.rank.clear_cache() # long time sage: J.rank() # long time 2 + """ + @staticmethod + def _max_random_instance_size(): + r""" + The maximum rank of a random QuaternionHermitianEJA. + """ + return 1 # Dimension 1 + + @classmethod + def random_instance(cls, **kwargs): + """ + Return a random instance of this type of algebra. + """ + n = ZZ.random_element(cls._max_random_instance_size() + 1) + return cls(n, **kwargs) + def __init__(self, n, field=AA, **kwargs): if n > 3: # Otherwise we don't get an EJA. @@ -2754,6 +2772,28 @@ class OctonionHermitianEJA(FiniteDimensionalEJA, MatrixEJA): """ return (X*Y).trace().real().coefficient(0) + +class AlbertEJA(OctonionHermitianEJA): + r""" + The Albert algebra is the algebra of three-by-three Hermitian + matrices whose entries are octonions. + + SETUP:: + + from mjo.eja.eja_algebra import AlbertEJA + + EXAMPLES:: + + sage: AlbertEJA(field=QQ, orthonormalize=False) + Euclidean Jordan algebra of dimension 27 over Rational Field + sage: AlbertEJA() # long time + Euclidean Jordan algebra of dimension 27 over Algebraic Real Field + + """ + def __init__(self, *args, **kwargs): + super().__init__(3, *args, **kwargs) + + class HadamardEJA(ConcreteEJA, RationalBasisEJA): """ Return the Euclidean Jordan Algebra corresponding to the set @@ -3641,7 +3681,9 @@ class RationalBasisCartesianProductEJA(CartesianProductEJA, SETUP:: - sage: from mjo.eja.eja_algebra import (JordanSpinEJA, + sage: from mjo.eja.eja_algebra import (HadamardEJA, + ....: JordanSpinEJA, + ....: OctonionHermitianEJA, ....: RealSymmetricEJA) EXAMPLES: @@ -3658,15 +3700,32 @@ class RationalBasisCartesianProductEJA(CartesianProductEJA, sage: J.rank() 5 + TESTS: + + The ``cartesian_product()`` function only uses the first factor to + decide where the result will live; thus we have to be careful to + check that all factors do indeed have a `_rational_algebra` member + before we try to access it:: + + sage: J1 = OctonionHermitianEJA(1) # no rational basis + sage: J2 = HadamardEJA(2) + sage: cartesian_product([J1,J2]) + Euclidean Jordan algebra of dimension 1 over Algebraic Real Field + (+) Euclidean Jordan algebra of dimension 2 over Algebraic Real Field + sage: cartesian_product([J2,J1]) + Euclidean Jordan algebra of dimension 2 over Algebraic Real Field + (+) Euclidean Jordan algebra of dimension 1 over Algebraic Real Field + """ def __init__(self, algebras, **kwargs): CartesianProductEJA.__init__(self, algebras, **kwargs) self._rational_algebra = None if self.vector_space().base_field() is not QQ: - self._rational_algebra = cartesian_product([ - r._rational_algebra for r in algebras - ]) + if all( hasattr(r, "_rational_algebra") for r in algebras ): + self._rational_algebra = cartesian_product([ + r._rational_algebra for r in algebras + ]) RationalBasisEJA.CartesianProduct = RationalBasisCartesianProductEJA