From de4fb553c035525bf00ffea5617fdf1c492c003f Mon Sep 17 00:00:00 2001 From: Michael Engen Date: Sun, 5 Nov 2023 20:38:34 -0500 Subject: [PATCH] Added min_length to permutation (#55) --- src/permpy/permutation.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/permpy/permutation.py b/src/permpy/permutation.py index af0a8a1..fd0800b 100644 --- a/src/permpy/permutation.py +++ b/src/permpy/permutation.py @@ -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: @@ -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() @@ -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()