generally rules out using the rationals as your ``field``, but
is required for spectral decompositions.
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import random_eja
+
+ TESTS:
+
+ We should compute that an element subalgebra is associative even
+ if we circumvent the element method::
+
+ sage: set_random_seed()
+ sage: J = random_eja(field=QQ,orthonormalize=False)
+ sage: x = J.random_element()
+ sage: A = x.subalgebra_generated_by(orthonormalize=False)
+ sage: basis = tuple(b.superalgebra_element() for b in A.basis())
+ sage: J.subalgebra(basis, orthonormalize=False).is_associative()
+ True
+
"""
Element = FiniteDimensionalEJAElement
inner_product,
field=AA,
orthonormalize=True,
- associative=False,
+ associative=None,
cartesian_product=False,
check_field=True,
check_axioms=True,
category = MagmaticAlgebras(field).FiniteDimensional()
category = category.WithBasis().Unital().Commutative()
+ if associative is None:
+ # We should figure it out. As with check_axioms, we have to do
+ # this without the help of the _jordan_product_is_associative()
+ # method because we need to know the category before we
+ # initialize the algebra.
+ associative = all( jordan_product(jordan_product(bi,bj),bk)
+ ==
+ jordan_product(bi,jordan_product(bj,bk))
+ for bi in basis
+ for bj in basis
+ for bk in basis)
+
if associative:
# Element subalgebras can take advantage of this.
category = category.Associative()
SETUP::
- sage: from mjo.eja.eja_algebra import (RealSymmetricEJA,
+ sage: from mjo.eja.eja_algebra import (random_eja,
+ ....: RealSymmetricEJA,
....: ComplexHermitianEJA,
....: QuaternionHermitianEJA)
sage: A._jordan_product_is_associative()
True
+ TESTS:
+
+ The values we've presupplied to the constructors agree with
+ the computation::
+
+ sage: set_random_seed()
+ sage: J = random_eja()
+ sage: J.is_associative() == J._jordan_product_is_associative()
+ True
+
"""
R = self.base_ring()
if not all( all(b_i in QQ for b_i in b.list()) for b in basis ):
raise TypeError("basis not rational")
+ super().__init__(basis,
+ jordan_product,
+ inner_product,
+ field=field,
+ check_field=check_field,
+ **kwargs)
+
self._rational_algebra = None
if field is not QQ:
# There's no point in constructing the extra algebra if this
jordan_product,
inner_product,
field=QQ,
+ associative=self.is_associative(),
orthonormalize=False,
check_field=False,
check_axioms=False)
- super().__init__(basis,
- jordan_product,
- inner_product,
- field=field,
- check_field=check_field,
- **kwargs)
-
@cached_method
def _charpoly_coefficients(self):
r"""
# if the user passes check_axioms=True.
if "check_axioms" not in kwargs: kwargs["check_axioms"] = False
+ associative = False
+ if n <= 1:
+ associative = True
+
super(RealSymmetricEJA, self).__init__(self._denormalized_basis(n),
self.jordan_product,
self.trace_inner_product,
+ associative=associative,
**kwargs)
# TODO: this could be factored out somehow, but is left here
# if the user passes check_axioms=True.
if "check_axioms" not in kwargs: kwargs["check_axioms"] = False
+ associative = False
+ if n <= 1:
+ associative = True
+
super(ComplexHermitianEJA, self).__init__(self._denormalized_basis(n),
self.jordan_product,
self.trace_inner_product,
+ associative=associative,
**kwargs)
# TODO: this could be factored out somehow, but is left here
# because the MatrixEJA is not presently a subclass of the
# if the user passes check_axioms=True.
if "check_axioms" not in kwargs: kwargs["check_axioms"] = False
+ associative = False
+ if n <= 1:
+ associative = True
+
super(QuaternionHermitianEJA, self).__init__(self._denormalized_basis(n),
self.jordan_product,
self.trace_inner_product,
+ associative=associative,
**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().
n = B.nrows()
column_basis = tuple( b.column() for b in FreeModule(ZZ, n).basis() )
+
+ # TODO: I haven't actually checked this, but it seems legit.
+ associative = False
+ if n <= 2:
+ associative = True
+
super(BilinearFormEJA, self).__init__(column_basis,
jordan_product,
inner_product,
+ associative=associative,
**kwargs)
# The rank of this algebra is two, unless we're in a
super(TrivialEJA, self).__init__(basis,
jordan_product,
inner_product,
+ associative=True,
**kwargs)
+
# The rank is zero using my definition, namely the dimension of the
# largest subalgebra generated by any element.
self.rank.set_cache(0)