Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Moving CombinatorialFreeModuleElement to own (Cython) file.
Browse files Browse the repository at this point in the history
This involves renaming the class to IndexedFreeModuleElement.
  • Loading branch information
Travis Scrimshaw committed Mar 17, 2017
1 parent 457b950 commit e918674
Show file tree
Hide file tree
Showing 18 changed files with 945 additions and 857 deletions.
3 changes: 3 additions & 0 deletions src/module_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,9 @@ def uname_specific(name, value, alternative):
Extension('sage.modules.vector_real_double_dense',
['sage/modules/vector_real_double_dense.pyx']),

Extension('sage.modules.with_basis.indexed_free_module_element',
sources = ['sage/modules/with_basis/indexed_free_module_element.pyx']),

################################
##
## sage.numerical
Expand Down
4 changes: 2 additions & 2 deletions src/sage/algebras/free_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
from sage.rings.ring import Algebra
from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomialRing_libsingular
from sage.categories.algebras_with_basis import AlgebrasWithBasis
from sage.combinat.free_module import CombinatorialFreeModule, CombinatorialFreeModuleElement
from sage.combinat.free_module import CombinatorialFreeModule
from sage.combinat.words.word import Word
from sage.structure.category_object import normalize_names

Expand Down Expand Up @@ -1336,7 +1336,7 @@ def expansion(self, t):
return sum([i[1] * self._alg.lie_polynomial(i[0]) for i in list(t)],
self._alg.zero())

class Element(CombinatorialFreeModuleElement):
class Element(CombinatorialFreeModule.Element):
def expand(self):
"""
Expand ``self`` in the monomials of the free algebra.
Expand Down
14 changes: 7 additions & 7 deletions src/sage/algebras/free_algebra_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from sage.misc.misc import repr_lincomb
from sage.monoids.free_monoid_element import FreeMonoidElement
from sage.combinat.free_module import CombinatorialFreeModuleElement
from sage.modules.with_basis.indexed_free_module_element import IndexedFreeModuleElement
from sage.structure.element import AlgebraElement
from sage.structure.sage_object import richcmp

Expand All @@ -45,7 +45,7 @@


# We need to have AlgebraElement first to avoid a segfault...
class FreeAlgebraElement(AlgebraElement, CombinatorialFreeModuleElement):
class FreeAlgebraElement(AlgebraElement, IndexedFreeModuleElement):
"""
A free algebra element.
"""
Expand All @@ -71,13 +71,13 @@ def __init__(self, A, x):
else:
raise TypeError("Argument x (= {}) is of the wrong type.".format(x))

CombinatorialFreeModuleElement.__init__(self, A, x)
IndexedFreeModuleElement.__init__(self, A, x)

# ...however AlgebraElement has a default error raising version of these
# so we must explicitly pull them from CombinatorialFreeModuleElement
_add_ = CombinatorialFreeModuleElement._add_
_sub_ = CombinatorialFreeModuleElement._sub_
_neg_ = CombinatorialFreeModuleElement._neg_
# so we must explicitly pull them from IndexedFreeModuleElement
_add_ = IndexedFreeModuleElement._add_
_sub_ = IndexedFreeModuleElement._sub_
_neg_ = IndexedFreeModuleElement._neg_

def _repr_(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/algebras/iwahori_hecke_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from sage.arith.all import is_square
from sage.combinat.root_system.weyl_group import WeylGroup
from sage.combinat.family import Family
from sage.combinat.free_module import CombinatorialFreeModule, CombinatorialFreeModuleElement
from sage.combinat.free_module import CombinatorialFreeModule

def normalized_laurent_polynomial(R, p):
r"""
Expand Down Expand Up @@ -1657,7 +1657,7 @@ def goldman_involution_on_basis(self, w):
H = self.realization_of()
return (-H._q_prod)**w.length() * self.monomial(w.inverse()).inverse()

class Element(CombinatorialFreeModuleElement):
class Element(CombinatorialFreeModule.Element):
r"""
A class for elements of an Iwahori-Hecke algebra in the `T` basis.
Expand Down
13 changes: 6 additions & 7 deletions src/sage/algebras/steenrod/steenrod_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@
from __future__ import print_function
from __future__ import absolute_import

from sage.combinat.free_module import CombinatorialFreeModule, \
CombinatorialFreeModuleElement
from sage.combinat.free_module import CombinatorialFreeModule
from sage.misc.lazy_attribute import lazy_attribute
from sage.misc.cachefunc import cached_method
from sage.categories.all import ModulesWithBasis, tensor, Hom
Expand Down Expand Up @@ -3073,22 +3072,22 @@ def is_generic(self):
# element class
######################################################

class Element(CombinatorialFreeModuleElement):
class Element(CombinatorialFreeModule.Element):
r"""
Class for elements of the Steenrod algebra. Since the
Steenrod algebra class is based on
:class:`CombinatorialFreeModule
<sage.combinat.free_module.CombinatorialFreeModule>`, this is
based on :class:`CombinatorialFreeModuleElement
<sage.combinat.free_module.CombinatorialFreeModuleElement>`.
based on :class:`IndexedFreeModuleElement
<sage.modules.with_basis.indexed_free_module_element.IndexedFreeModuleElement>`.
It has new methods reflecting its role, like :meth:`degree`
for computing the degree of an element.
EXAMPLES:
Since this class inherits from
:class:`CombinatorialFreeModuleElement
<sage.combinat.free_module.CombinatorialFreeModuleElement>`,
:class:`IndexedFreeModuleElement
<sage.modules.with_basis.indexed_free_module_element.IndexedFreeModuleElement>`,
elements can be used as iterators, and there are other useful
methods::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/weyl_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sage.categories.algebras_with_basis import AlgebrasWithBasis
from sage.sets.family import Family
import sage.data_structures.blas_dict as blas
from sage.combinat.free_module import _divide_if_possible
from sage.modules.with_basis.indexed_free_module_element import _divide_if_possible
from sage.rings.ring import Algebra
from sage.rings.polynomial.polynomial_ring import PolynomialRing_general
from sage.rings.polynomial.multi_polynomial_ring_generic import MPolynomialRing_generic
Expand Down
8 changes: 4 additions & 4 deletions src/sage/categories/examples/filtered_modules_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class FilteredPartitionModule(CombinatorialFreeModule):
'P[4, 3]'
- There is a class for elements, which inherits from
:class:`CombinatorialFreeModuleElement
<sage.combinat.free_module.CombinatorialFreeModuleElement>`. An
element is determined by a dictionary whose keys are partitions and whose
corresponding values are the coefficients. The class implements
:class:`IndexedFreeModuleElement
<sage.modules.with_basis.indexed_free_module_element.IndexedFreeModuleElement>`.
An element is determined by a dictionary whose keys are partitions and
whose corresponding values are the coefficients. The class implements
two things: an :meth:`is_homogeneous
<FilteredModules.Element.is_homogeneous>` method and a
:meth:`degree <FilteredModules.Element.degree>` method.
Expand Down
8 changes: 4 additions & 4 deletions src/sage/categories/examples/graded_modules_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ class GradedPartitionModule(CombinatorialFreeModule):
'P[4, 3]'
- There is a class for elements, which inherits from
:class:`CombinatorialFreeModuleElement
<sage.combinat.free_module.CombinatorialFreeModuleElement>`. An
element is determined by a dictionary whose keys are partitions and whose
corresponding values are the coefficients. The class implements
:class:`IndexedFreeModuleElement
<sage.modules.with_basis.indexed_free_module_element.IndexedFreeModuleElement>`.
An element is determined by a dictionary whose keys are partitions and
whose corresponding values are the coefficients. The class implements
two things: an :meth:`is_homogeneous
<GradedModules.Element.is_homogeneous>` method and a
:meth:`degree <GradedModules.Element.degree>` method.
Expand Down
5 changes: 2 additions & 3 deletions src/sage/combinat/diagram_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
from sage.categories.algebras import Algebras
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
from sage.structure.element import generic_power
from sage.combinat.free_module import (CombinatorialFreeModule,
CombinatorialFreeModuleElement)
from sage.combinat.free_module import CombinatorialFreeModule
from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
from sage.combinat.combinat import bell_number, catalan_number
Expand Down Expand Up @@ -1462,7 +1461,7 @@ def sgn(x):

# The following subclass provides a few additional methods for
# partition algebra elements.
class Element(CombinatorialFreeModuleElement):
class Element(CombinatorialFreeModule.Element):
r"""
An element of a diagram algebra.
Expand Down
Loading

0 comments on commit e918674

Please sign in to comment.