1 | initial version |
The best thing to do is to use the source. The group algebra of a group is implemented nicely in SAGE_ROOT/devel/sage/sage/categories/examples/hopf_algebras_with_basis.py
, in a way which works well with inheritance and the category structure in Sage. See also the patches at http://trac.sagemath.org/sage_trac/ticket/6670, for a very similar implementation, but one which also implements coercion.
This implementation doesn't inherit from a generic algebra structure, but instead from CombinatorialFreeModule
(an implementation of free modules which is well suited to incorporating algebraic structures), and then sets the category appropriately, which helps to automatically implement some structure.
The patches at http://trac.sagemath.org/sage_trac/ticket/10052 (merged into prerelease versions of Sage 4.7.1) does something similar to implement the Steenrod algebra and its sub-Hopf algebras.