# 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,
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
from sage.matrix.constructor import matrix
-from mjo.eja.eja_algebra import FiniteDimensionalEJA
-from mjo.eja.eja_element import FiniteDimensionalEJAElement
+from sage.combinat.free_module import CombinatorialFreeModule_CartesianProduct
+
+from mjo.eja.eja_algebra import (CartesianProductEJA,
+ FiniteDimensionalEJA)
+from mjo.eja.eja_element import (CartesianProductEJAElement,
+ FiniteDimensionalEJAElement)
class FiniteDimensionalEJASubalgebraElement(FiniteDimensionalEJAElement):
"""
Element = FiniteDimensionalEJASubalgebraElement
+
+
+
+class CartesianProductEJASubalgebraElement(CartesianProductEJAElement,
+ FiniteDimensionalEJASubalgebraElement):
+ pass
+
+class CartesianProductEJASubalgebra(CartesianProductEJA,
+ FiniteDimensionalEJASubalgebra):
+
+ def __init__(self, superalgebra, basis, **kwargs):
+ CombinatorialFreeModule_CartesianProduct.__init__(self,
+ superalgebra.cartesian_factors())
+ FiniteDimensionalEJASubalgebra.__init__(self,
+ superalgebra,
+ basis,
+ cartesian_product=True,
+ **kwargs)
+
+
+ Element = CartesianProductEJASubalgebraElement