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

Commit

Permalink
PositiveIntegers -> NonNegativeIntegers
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorkarn committed Oct 11, 2022
1 parent ae1d71a commit 217c203
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/sage/combinat/diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,20 +422,18 @@ def __iter__(self):
[(0, 0), (0, 1), (1, 1)]
[(0, 0), (0, 1), (1, 0), (1, 1)]
"""
from sage.sets.positive_integers import PositiveIntegers
from sage.all import cartesian_product
from sage.sets.non_negative_integers import NonNegativeIntegers
from sage.categories.cartesian_product import cartesian_product
from sage.misc.misc import subsets
# the product of positive integers automatically implements an
# an enumeration which allows us to get out of the first column
PP = PositiveIntegers()
P = cartesian_product([PP, PP])
X = subsets(P)
N = NonNegativeIntegers()
NxN = cartesian_product([N, N])
X = subsets(NxN)
while True:
# we want to allow cells in the index-0 row but we
# dont want all of them to be in the index-0 row
cells = next(X)
try:
yield self.element_class(self, tuple((i-1, j-1) for i,j in cells))
yield self.element_class(self, tuple((i, j) for i,j in cells))
except ValueError:
# if cells causes the .check method of a
# subclass to fail, just go to the next one
Expand Down

0 comments on commit 217c203

Please sign in to comment.