]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add subalgebra() method.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 24 Feb 2021 19:11:13 +0000 (14:11 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 24 Feb 2021 19:11:13 +0000 (14:11 -0500)
mjo/eja/eja_algebra.py
mjo/eja/eja_element.py

index 51ff79054eab8cdb83fe48c3d566131598b46278..8005412e65da8b6192072420dffe794c7975b5d0 100644 (file)
@@ -1029,14 +1029,12 @@ class FiniteDimensionalEJA(CombinatorialFreeModule):
         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
@@ -1046,9 +1044,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule):
                 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:
@@ -1267,6 +1263,17 @@ class FiniteDimensionalEJA(CombinatorialFreeModule):
         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.
index 4c9993a2cae68c8064a087c344ef2a5bf23877c5..42e5782c4539c97fcd71805b50c81cd4a96877a5 100644 (file)
@@ -1413,12 +1413,8 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
             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