if not c.is_idempotent():
raise ValueError("element is not idempotent: %s" % c)
- from mjo.eja.eja_subalgebra import FiniteDimensionalEJASubalgebra
-
# Default these to what they should be if they turn out to be
# trivial, because eigenspaces_left() won't return eigenvalues
# corresponding to trivial spaces (e.g. it returns only the
# eigenspace corresponding to lambda=1 if you take the
# decomposition relative to the identity element).
- trivial = FiniteDimensionalEJASubalgebra(self, ())
+ trivial = self.subalgebra(())
J0 = trivial # eigenvalue zero
J5 = VectorSpace(self.base_ring(), 0) # eigenvalue one-half
J1 = trivial # eigenvalue one
J5 = eigspace
else:
gens = tuple( self.from_vector(b) for b in eigspace.basis() )
- subalg = FiniteDimensionalEJASubalgebra(self,
- gens,
- check_axioms=False)
+ subalg = self.subalgebra(gens, check_axioms=False)
if eigval == 0:
J0 = subalg
elif eigval == 1:
return len(self._charpoly_coefficients())
+ def subalgebra(self, basis, **kwargs):
+ r"""
+ Create a subalgebra of this algebra from the given basis.
+
+ This is a simple wrapper around a subalgebra class constructor
+ that can be overridden in subclasses.
+ """
+ from mjo.eja.eja_subalgebra import FiniteDimensionalEJASubalgebra
+ return FiniteDimensionalEJASubalgebra(self, basis, **kwargs)
+
+
def vector_space(self):
"""
Return the vector space that underlies this algebra.
True
"""
- from mjo.eja.eja_subalgebra import FiniteDimensionalEJASubalgebra
powers = tuple( self**k for k in range(self.degree()) )
- A = FiniteDimensionalEJASubalgebra(self.parent(),
- powers,
- associative=True,
- **kwargs)
+ A = self.parent().subalgebra(powers, associative=True, **kwargs)
A.one.set_cache(A(self.parent().one()))
return A