From 6a5829a24c5ed96abe5063cf463f19ea71ffa075 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 2 Dec 2020 09:46:47 -0500 Subject: [PATCH] eja: speed up construction of JordanSpinEJA and HadamardEJA. --- mjo/eja/eja_algebra.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 70be6ed..e9f971f 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1355,9 +1355,11 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr Algebraic Real Field """ - if self.base_ring() is QQ: + if self.base_ring() is QQ or self._rational_algebra is None: # There's no need to construct *another* algebra over the - # rationals if this one is already over the rationals. + # rationals if this one is already over the + # rationals. Likewise, if we never orthonormalized our + # basis, we might as well just use the given one. superclass = super(RationalBasisEuclideanJordanAlgebra, self) return superclass._charpoly_coefficients() @@ -2273,10 +2275,15 @@ class HadamardEJA(ConcreteEuclideanJordanAlgebra): def inner_product(x,y): return x.inner_product(y) + # Don't orthonormalize because our basis is already orthonormal + # with respect to our inner-product. super(HadamardEJA, self).__init__(field, basis, jordan_product, inner_product, + orthonormalize=False, + check_field=False, + check_axioms=False, **kwargs) self.rank.set_cache(n) @@ -2500,10 +2507,18 @@ class JordanSpinEJA(BilinearFormEJA): """ def __init__(self, n, field=AA, **kwargs): - # This is a special case of the BilinearFormEJA with the identity - # matrix as its bilinear form. + # This is a special case of the BilinearFormEJA with the + # identity matrix as its bilinear form. B = matrix.identity(field, n) - super(JordanSpinEJA, self).__init__(B, field, **kwargs) + + # Don't orthonormalize because our basis is already + # orthonormal with respect to our inner-product. + super(JordanSpinEJA, self).__init__(B, + field, + orthonormalize=False, + check_field=False, + check_axioms=False, + **kwargs) @staticmethod def _max_random_instance_size(): -- 2.44.2