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

Commit

Permalink
Changed the name of iterator to callable.
Browse files Browse the repository at this point in the history
  • Loading branch information
tejasvicsr1 committed Aug 17, 2021
1 parent 6cfdf8d commit eef15d8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/sage/combinat/species/cycle_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _isotypes(self, structure_class, labels):
if len(labels) != 0:
yield structure_class(self, labels, range(1, len(labels)+1))

def _gs_iterator(self, base_ring, n):
def _gs_callable(self, base_ring, n):
r"""
The generating series for cyclic permutations is
`-\log(1-x) = \sum_{n=1}^\infty x^n/n`.
Expand Down Expand Up @@ -235,7 +235,7 @@ def _itgs_list(self, base_ring, n):
"""
return base_ring(0) if n == 0 else self._weight*base_ring(1)

def _cis_iterator(self, base_ring):
def _cis_callable(self, base_ring):
r"""
The cycle index series of the species of cyclic permutations is
given by
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/species/linear_order_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _itgs_list(self, base_ring, n):
return base_ring(1)


def _cis_iterator(self, base_ring):
def _cis_callable(self, base_ring, n):
"""
EXAMPLES::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/species/partition_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _canonical_rep_from_partition(self, structure_class, labels, p):
breaks = [sum(p[:i]) for i in range(len(p) + 1)]
return structure_class(self, labels, [list(range(breaks[i]+1, breaks[i+1]+1)) for i in range(len(p))])

def _gs_iterator(self, base_ring, n):
def _gs_callable(self, base_ring, n):
r"""
EXAMPLES::
Expand All @@ -245,7 +245,7 @@ def _gs_iterator(self, base_ring, n):
from sage.combinat.combinat import bell_number
return self._weight * base_ring(bell_number(n) / factorial(n))

def _itgs_iterator(self, base_ring, n):
def _itgs_callable(self, base_ring, n):
r"""
The isomorphism type generating series is given by
`\frac{1}{1-x}`.
Expand Down
5 changes: 1 addition & 4 deletions src/sage/combinat/species/permutation_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def _gs_list(self, base_ring, n):
return base_ring(1)


def _itgs_iterator(self, base_ring, n):
def _itgs_callable(self, base_ring, n):
r"""
The isomorphism type generating series is given by
`\frac{1}{1-x}`.
Expand All @@ -213,9 +213,6 @@ def _itgs_iterator(self, base_ring, n):
sage: [g.coefficient(i) for i in range(10)]
[1, 1, 2, 3, 5, 7, 11, 15, 22, 30]
"""
# from sage.combinat.partition import number_of_partitions
# for n in _integers_from(0):
# yield base_ring(number_of_partitions(n))
from sage.combinat.partition import number_of_partitions
return base_ring(number_of_partitions(n))

Expand Down
4 changes: 1 addition & 3 deletions src/sage/combinat/species/set_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _structures(self, structure_class, labels):

_isotypes = _structures

def _gs_iterator(self, base_ring, n):
def _gs_callable(self, base_ring, n):
r"""
The generating series for the species of sets is given by
`e^x`.
Expand All @@ -144,8 +144,6 @@ def _gs_iterator(self, base_ring, n):
sage: [g.count(i) for i in range(10)]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
"""
# for n in _integers_from(0):
# yield base_ring(self._weight / factorial(n))
return base_ring(self._weight / factorial(n))

def _itgs_list(self, base_ring, n):
Expand Down
10 changes: 5 additions & 5 deletions src/sage/combinat/species/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,16 +555,16 @@ def _series_helper(self, series_ring_class, prefix, base_ring=None):
except AttributeError:
pass

# Try to return things like self._gs_iterator(base_ring).
# This is used when the subclass just provides an iterator
# Try to return things like self._gs_callable(base_ring).
# This is used when the subclass just provides an callable
# for the coefficients of the generating series. Optionally,
# the subclass can specify the order of the series.
try:
iterator = getattr(self, prefix + "_iterator")
callable = getattr(self, prefix + "_callable")
try:
return series_ring(lambda n: iterator(base_ring, n), valuation=self._order())
return series_ring(lambda n: callable(base_ring, n), valuation=self._order())
except AttributeError:
return series_ring(lambda n: iterator(base_ring, n))
return series_ring(lambda n: callable(base_ring, n))
except AttributeError:
pass

Expand Down
6 changes: 2 additions & 4 deletions src/sage/combinat/species/subset_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def _isotypes(self, structure_class, labels):
for i in range(len(labels)+1):
yield structure_class(self, labels, range(1, i+1))

def _gs_iterator(self, base_ring, n):
def _gs_callable(self, base_ring, n):
"""
The generating series for the species of subsets is
`e^{2x}`.
Expand All @@ -199,10 +199,8 @@ def _gs_iterator(self, base_ring, n):
[1, 2, 2, 4/3, 2/3]
"""
return base_ring(2)**n / base_ring(factorial(n))
# for n in _integers_from(0):
# yield base_ring(2)**n / base_ring(factorial(n))

def _itgs_iterator(self, base_ring, n):
def _itgs_callable(self, base_ring, n):
r"""
The generating series for the species of subsets is
`e^{2x}`.
Expand Down

0 comments on commit eef15d8

Please sign in to comment.