Skip to content

Commit

Permalink
Added min_length to permutation (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
engenmt authored Nov 6, 2023
1 parent e96bfe9 commit de4fb55
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/permpy/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ def all_monotone_intervals(self, with_ones=False):

if with_ones:
in_int = []
for (start, end) in mi:
for start, end in mi:
in_int.extend(range(start, end + 1))
for i in range(len(self)):
if i not in in_int:
Expand Down Expand Up @@ -1032,13 +1032,12 @@ def test(p):

return L

def downset(self):
def downset(self, min_length=0):
"""Return the downset D of `self` stratified by length."""
new_perms = {self: 0}
downset = [set([self])]

for new_length in range(len(self) - 1, -1, -1):

for new_length in range(len(self) - 1, min_length - 1, -1):
old_perms = new_perms
new_perms = dict()

Expand Down Expand Up @@ -1067,7 +1066,6 @@ def downset_profile(self):
profile = [len(new_perms)]

for new_length in range(len(self) - 1, -1, -1):

old_perms = new_perms
new_perms = dict()

Expand Down

0 comments on commit de4fb55

Please sign in to comment.