]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_algebra.py
eja: add subalgebra() method for algebras.
[sage.d.git] / mjo / eja / eja_algebra.py
index 8005412e65da8b6192072420dffe794c7975b5d0..9ba146bc6e8fd6dc97dcf1f7d70058cd046528a4 100644 (file)
@@ -119,11 +119,12 @@ class FiniteDimensionalEJA(CombinatorialFreeModule):
         # Call the superclass constructor so that we can use its from_vector()
         # method to build our multiplication table.
         n = len(basis)
-        super().__init__(field,
-                         range(n),
-                         prefix=prefix,
-                         category=category,
-                         bracket=False)
+        CombinatorialFreeModule.__init__(self,
+                                         field,
+                                         range(n),
+                                         prefix=prefix,
+                                         category=category,
+                                         bracket=False)
 
         # Now comes all of the hard work. We'll be constructing an
         # ambient vector space V that our (vectorized) basis lives in,
@@ -3134,6 +3135,16 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
         except:
             raise ValueError("not an element of this algebra")
 
+    def subalgebra(self, basis, **kwargs):
+        r"""
+        Create a subalgebra of this algebra from the given basis.
+
+        This overrides the superclass method to use a special class
+        for Cartesian products.
+        """
+        from mjo.eja.eja_subalgebra import CartesianProductEJASubalgebra
+        return CartesianProductEJASubalgebra(self, basis, **kwargs)
+
     Element = CartesianProductEJAElement