Skip to content

Commit

Permalink
added some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypantone committed Oct 24, 2013
1 parent 331989f commit 1a92c96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion permset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __repr__(self):
@staticmethod
def all(n):
''' builds the set of all permutations of length n'''
return PermSet(permutation.Permutation.listall(n))
return PermSet(Permutation.listall(n))

def show_all(self):
return set.__repr__(self)
Expand Down
9 changes: 9 additions & 0 deletions permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ def ltrmin(self):
if flag: L.append(i)
return L

def rtlmax(self):
return [len(self)-i-1 for i in self.complement().reverse().ltrmin()][::-1]

def numltrmin(self):
p = list(self)
n = self.__len__()
Expand Down Expand Up @@ -544,6 +547,12 @@ def set_up_bounds(self):
upper_bound[i] = j
return (lower_bound, upper_bound)

def avoids(self, P):
return not P.involved_in(self)

def involves(self, P):
return P.involved_in(self)

def involved_in(self, P):
if not self.bounds_set:
(self.lower_bound, self.upper_bound) = self.set_up_bounds()
Expand Down

0 comments on commit 1a92c96

Please sign in to comment.