How to use the permuta.demo.perm.Perm function in permuta

To help you get started, we’ve selected a few permuta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def shift_down(self, times=1):
        """Return the perm shifted times steps down."""
        return Perm(self._zb_perm.shift_down(times))
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def occurrences_in(self, perm):
        """Find all occurrences of the patt self in perm.

        See also:
            Perm.avoids
            Perm.contains
            Perm.occurrence*
        """
        perm = Perm(perm)
        return list(list(perm[index + 1] for index in occurrence_indices)
                    for occurrence_indices
                    in self._zb_perm.occurrences_in(perm._zb_perm))
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def reverse_complement(self):
        """Return the reverse complement of the perm."""
        return Perm(self._zb_perm.reverse_complement())
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def shift_up(self, times=1):
        """Return the perm shifted times steps up."""
        return Perm(self._zb_perm.shift_up(times))
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def occurrences_of(self, patt):
        """Find all occurrences of patt in the perm self.

        See also:
                Perm.avoids
                Perm.contains
                Perm.occurrence*
        """
        patt = Perm(patt)
        return patt.occurrences_in(self)
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def direct_sum(self, perm):
        """Return the direct sum of the two perms.

        See also:
            Perm.__sum__
        """
        perm = Perm(perm)
        zb_perm = self._zb_perm.direct_sum(perm._zb_perm)
        return Perm(zb_perm)
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def _assert_perm(perm):
    """Helper function for this module."""
    # TODO: Do we want to use this function anyway?
    if not isinstance(perm, Perm):
        raise TypeError("Not a perm: {}".format(perm))
    else:
        return True
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def __imul__(self, perm):
        return self*Perm(perm)
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def skew_sum(self, perm):
        """Return the skew sum of the two perms.

        See also:
            Perm.__sub__
        """
        perm = Perm(perm)
        zb_perm = self._zb_perm.skew_sum(perm._zb_perm)
        return Perm(zb_perm)
github PermutaTriangle / Permuta / permuta / demo / perm.py View on Github external
def compose(self, perm):
        """Return the composition of the two perms.

        See also:
            Perm.multiply
            Perm.__mul__
        """
        perm = Perm(perm)
        zb_perm = self._zb_perm.compose(perm._zb_perm)
        return Perm(zb_perm)