from sage.matrix.constructor import matrix
+from sage.misc.cachefunc import cached_method
from sage.rings.all import QQ
from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanSubalgebra
# Pick those out of the list of all powers.
superalgebra_basis = tuple(map(powers.__getitem__, ind_rows))
- basis_vectors = map(power_vectors.__getitem__, ind_rows)
else:
# If we're going to orthonormalize the basis anyway, we
# might as well just do Gram-Schmidt on the whole list of
self.rank.set_cache(self.dimension())
+ @cached_method
def one(self):
"""
Return the multiplicative identity element of this algebra.
The superclass method computes the identity element, which is
beyond overkill in this case: the superalgebra identity
restricted to this algebra is its identity. Note that we can't
- count on the first basis element being the identity -- it migth
+ count on the first basis element being the identity -- it might
have been scaled if we orthonormalized the basis.
SETUP::
"""
if self.dimension() == 0:
return self.zero()
- else:
- sa_one = self.superalgebra().one().to_vector()
- # The extra hackery is because foo.to_vector() might not
- # live in foo.parent().vector_space()!
- coords = sum( a*b for (a,b)
- in zip(sa_one,
- self.superalgebra().vector_space().basis()) )
- return self.from_vector(self.vector_space().coordinate_vector(coords))
+
+ return self(self.superalgebra().one())