### Navigation

- index
- modules |
- next |
- previous |
- Combinatorics »

# Affine Permutations

class `sage.combinat.affine_permutation.``AffinePermutation`(parent, lst, check=True)

  Bases: `sage.structure.list_clone.ClonableArray`

  An affine permutation, representated in the window notation, and considered as a bijection from \(\ZZ\) to \(\ZZ\).

  EXAMPLES:

      sage: A=AffinePermutationGroup(['A',7,1])
      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `apply_simple_reflection`(i, side='right')

    Applies a simple reflection.

    INPUT:

    - `i` – an integer.
    - `side` – Determines whether to apply the reflection on the ‘right’ or ‘left’. Default ‘right’.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.apply_simple_reflection(3)
        Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
        sage: p.apply_simple_reflection(11)
        Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
        sage: p.apply_simple_reflection(3, 'left')
        Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]
        sage: p.apply_simple_reflection(11, 'left')
        Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]

  `grassmannian_quotient`(i=0, side='right')

    Return Grassmannian quotient.

    Factors `self` into a unique product of a Grassmannian and a finite-type element. Returns a tuple containing the Grassmannain and finite elements, in order according to side.

    INPUT:

    - `i` – An element of the index set; the descent checked for. Defaults to 0.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: gq=p.grassmannian_quotient()
        sage: gq
        (Type A affine permutation with window [-1, 0, 3, 4, 5, 6, 9, 10], Type A affine permutation with window [3, 1, 2, 6, 5, 4, 8, 7])
        sage: gq[0].is_i_grassmannian()
        True
        sage: 0 not in gq[1].reduced_word()
        True
        sage: prod(gq)==p
        True

        sage: gqLeft=p.grassmannian_quotient(side='left')
        sage: 0 not in gqLeft[0].reduced_word()
        True
        sage: gqLeft[1].is_i_grassmannian(side='left')
        True
        sage: prod(gqLeft)==p
        True

  `index_set`()

    Index set of the affine permutation group.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: A.index_set()
        (0, 1, 2, 3, 4, 5, 6, 7)

  `inverse`()

    Finds the inverse affine permutation.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.inverse()
        Type A affine permutation with window [0, -1, 1, 6, 5, 4, 10, 11]

  `is_i_grassmannian`(i=0, side='right')

    Test whether `self` is \(i\)-grassmannian, ie, either is the identity or has `i` as the sole descent.

    INPUT:

    - `i` – An element of the index set.
    - `side` – determines the side on which to check the descents.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.is_i_grassmannian()
        False
        sage: q=A.from_word([3,2,1,0])
        sage: q.is_i_grassmannian()
        True
        sage: q=A.from_word([2,3,4,5])
        sage: q.is_i_grassmannian(5)
        True
        sage: q.is_i_grassmannian(2, side='left')
        True

  `is_one`()

    Tests whether the affine permutation is the identity.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.is_one()
        False
        sage: q=A.one()
        sage: q.is_one()
        True

  `lower_covers`(side='right')

    Return lower covers of `self`.

    The set of affine permutations of one less length related by multiplication by a simple transposition on the indicated side. These are the elements that `self` covers in weak order.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.lower_covers()
        [Type A affine permutation with window [-1, 3, 0, 6, 5, 4, 10, 9], Type A affine permutation with window [3, -1, 0, 5, 6, 4, 10, 9], Type A affine permutation with window [3, -1, 0, 6, 4, 5, 10, 9], Type A affine permutation with window [3, -1, 0, 6, 5, 4, 9, 10]]

  `reduced_word`()

    Returns a reduced word for the affine permutation.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.reduced_word()
        [0, 7, 4, 1, 0, 7, 5, 4, 2, 1]

  `signature`()

    Signature of the affine permutation, \((-1)^l\), where \(l\) is the length of the permutation.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.signature()
        1

  `to_weyl_group_element`()

    The affine Weyl group element corresponding to the affine permutation.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.to_weyl_group_element()
        [ 0 -1  0  1  0  0  1  0]
        [ 1 -1  0  1  0  0  1 -1]
        [ 1 -1  0  1  0  0  0  0]
        [ 0  0  0  1  0  0  0  0]
        [ 0  0  0  1  0 -1  1  0]
        [ 0  0  0  1 -1  0  1  0]
        [ 0  0  0  0  0  0  1  0]
        [ 0 -1  1  0  0  0  1  0]

`sage.combinat.affine_permutation.``AffinePermutationGroup`(cartan_type)

  Wrapper function for specific affine permutation groups.

  These are combinatorial implmentations of the affine Weyl groups of types \(A\), \(B\), \(C\), \(D\), and \(G\) as permutations of the set of all integers. the basic algorithms are derived from [BjBr] and [Erik].

  REFERENCES:

  [BjBr] | Bjorner and Brenti. Combinatorics of Coxeter Groups. Springer, 2005.

  [Erik] | H. Erikson. Computational and Combinatorial Aspects of Coxeter Groups. Thesis, 1995.

  EXAMPLES:

      sage: ct=CartanType(['A',7,1])
      sage: A=AffinePermutationGroup(ct)
      sage: A
      The group of affine permutations of type ['A', 7, 1]

  We define an element of `A`:

      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  We find the value \(p(1)\), considering \(p\) as a bijection on the integers. This is the same as calling the ‘value’ method:

      sage: p.value(1)
      3
      sage: p(1)==p.value(1)
      True

  We can also find the position of the integer 3 in \(p\) considered as a sequence, equivalent to finding \(p^{-1}(3)\):

      sage: p.position(3)
      1
      sage: (p^-1)(3)
      1

  Since the affine permutation group is a group, we demonstrate its group properties:

      sage: A.one()
      Type A affine permutation with window [1, 2, 3, 4, 5, 6, 7, 8]

      sage: q=A([0, 2, 3, 4, 5, 6, 7, 9])
      sage: p*q
      Type A affine permutation with window [1, -1, 0, 6, 5, 4, 10, 11]
      sage: q*p
      Type A affine permutation with window [3, -1, 1, 6, 5, 4, 10, 8]

      sage: p^-1
      Type A affine permutation with window [0, -1, 1, 6, 5, 4, 10, 11]
      sage: p^-1*p==A.one()
      True
      sage: p*p^-1==A.one()
      True

  If we decide we prefer the Weyl Group implementation of the affine Weyl group, we can easily get it:

      sage: p.to_weyl_group_element()
      [ 0 -1  0  1  0  0  1  0]
      [ 1 -1  0  1  0  0  1 -1]
      [ 1 -1  0  1  0  0  0  0]
      [ 0  0  0  1  0  0  0  0]
      [ 0  0  0  1  0 -1  1  0]
      [ 0  0  0  1 -1  0  1  0]
      [ 0  0  0  0  0  0  1  0]
      [ 0 -1  1  0  0  0  1  0]

  We can find a reduced word and do all of the other things one expects in a Coxeter group:

      sage: p.has_right_descent(1)
      True
      sage: p.apply_simple_reflection(1)
      Type A affine permutation with window [-1, 3, 0, 6, 5, 4, 10, 9]
      sage: p.apply_simple_reflection(0)
      Type A affine permutation with window [1, -1, 0, 6, 5, 4, 10, 11]
      sage: p.reduced_word()
      [0, 7, 4, 1, 0, 7, 5, 4, 2, 1]
      sage: p.length()
      10

  The following methods are particular to Type \(A\). We can check if the element is fully commutative:

      sage: p.is_fully_commutative()
      False
      sage: q.is_fully_commutative()
      True

  And we can also compute the affine Lehmer code of the permutation, a weak composition with \(k+1\) entries:

      sage: p.to_lehmer_code()
      [0, 3, 3, 0, 1, 2, 0, 1]

  Once we have the Lehmer code, we can obtain a \(k\)-bounded partition by sorting the Lehmer code, and then reading the row lengths. There is a unique 0-Grassmanian (dominant) affine permutation associated to this \(k\)-bounded partition, and a \(k\)-core as well.

      sage: p.to_bounded_partition()
      [5, 3, 2]
      sage: p.to_dominant()
      Type A affine permutation with window [-2, -1, 1, 3, 4, 8, 10, 13]
      sage: p.to_core()
      [5, 3, 2]

  Finally, we can take a reduced word for \(p\) and insert it to find a standard composition tableau associated uniquely to that word.

      sage: p.tableau_of_word(p.reduced_word())
      [[], [1, 6, 9], [2, 7, 10], [], [3], [4, 8], [], [5]]

  We can also form affine permutation groups in types \(B\), \(C\), \(D\), and \(G\).

      sage: B=AffinePermutationGroup(['B',4,1])
      sage: B.an_element()
      Type B affine permutation with window [-1, 3, 4, 11]

      sage: C=AffinePermutationGroup(['C',4,1])
      sage: C.an_element()
      Type C affine permutation with window [2, 3, 4, 10]

      sage: D=AffinePermutationGroup(['D',4,1])
      sage: D.an_element()
      Type D affine permutation with window [-1, 3, 11, 5]

      sage: G=AffinePermutationGroup(['G',2,1])
      sage: G.an_element()
      Type G affine permutation with window [0, 4, -1, 8, 3, 7]

class `sage.combinat.affine_permutation.``AffinePermutationGroupGeneric`(cartan_type)

  Bases: `sage.structure.unique_representation.UniqueRepresentation`, `sage.structure.parent.Parent`

  The generic affine permutation group class, in which we define all type-free methods for the specific affine permutation groups.

  `cartan_matrix`()

    Returns the Cartan matrix of `self`.

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).cartan_matrix()
        [ 2 -1  0  0  0  0  0 -1]
        [-1  2 -1  0  0  0  0  0]
        [ 0 -1  2 -1  0  0  0  0]
        [ 0  0 -1  2 -1  0  0  0]
        [ 0  0  0 -1  2 -1  0  0]
        [ 0  0  0  0 -1  2 -1  0]
        [ 0  0  0  0  0 -1  2 -1]
        [-1  0  0  0  0  0 -1  2]

  `cartan_type`()

    Returns the Cartan type of `self`.

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).cartan_type()
        ['A', 7, 1]

  `classical`()

    Returns the finite permutation group.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: A.classical()
        Symmetric group of order 8! as a permutation group

  `from_word`(w)

    Builds an affine permutation from a given word. Note: Already in category as `from_reduced_word`, but this is less typing!

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: A.from_word([0, 7, 4, 1, 0, 7, 5, 4, 2, 1])
        Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `index_set`()

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).index_set()
        (0, 1, 2, 3, 4, 5, 6, 7)

  `is_crystallographic`()

    Tells whether the affine permutation group is crystallographic.

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).is_crystallographic()
        True

  `random_element`(n=None)

    Return a random affine permutation of length `n`.

    If `n` is not specified, then `n` is chosen as a random non-negative integer in \([0, 1000]\).

    Starts at the identity, then chooses an upper cover at random. Not very uniform: actually constructs a uniformly random reduced word of length \(n\). Thus we most likely get elements with lots of reduced words!

    For the actual code, see `sage.categories.coxeter_group.random_element_of_length()`.

    EXAMPLES:

        sage: A = AffinePermutationGroup(['A',7,1])
        sage: A.random_element() # random
        Type A affine permutation with window [-12, 16, 19, -1, -2, 10, -3, 9]
        sage: p = A.random_element(10)
        sage: p.length() == 10
        True

  `rank`()

    Rank of the affine permutation group, equal to \(k+1\).

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).rank()
        8

  `reflection_index_set`()

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).index_set()
        (0, 1, 2, 3, 4, 5, 6, 7)

  `weyl_group`()

    Returns the Weyl Group of the same type as `self`.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: A.weyl_group()
        Weyl Group of type ['A', 7, 1] (as a matrix group acting on the root space)

class `sage.combinat.affine_permutation.``AffinePermutationGroupTypeA`(cartan_type)

  Bases: `sage.combinat.affine_permutation.AffinePermutationGroupGeneric`

  TESTS:

      sage: AffinePermutationGroup(['A',7,1])
      The group of affine permutations of type ['A', 7, 1]

  `Element`

    alias of `AffinePermutationTypeA`

  `from_lehmer_code`(C, typ='decreasing', side='right')

    Returns the affine permutation with the supplied Lehmer code (a weak composition with \(k+1\) parts, at least one of which is 0).

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing’: type of product.

        (default: ‘decreasing’.)

    - `side` – ‘right’ or ‘left’: Whether the decomposition is from

        the right or left. (default: ‘right’.)

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.to_lehmer_code()
        [0, 3, 3, 0, 1, 2, 0, 1]
        sage: A.from_lehmer_code(p.to_lehmer_code())==p
        True
        sage: CP=CartesianProduct( ('increasing','decreasing'),('left','right') )
        sage: for a in CP:
        ....:   A.from_lehmer_code(p.to_lehmer_code(a[0],a[1]),a[0],a[1])==p
        True
        True
        True
        True

  `one`()

    Returns the identity element.

    EXAMPLES:

        sage: AffinePermutationGroup(['A',7,1]).one()
        Type A affine permutation with window [1, 2, 3, 4, 5, 6, 7, 8]

    TESTS:

        sage: A=AffinePermutationGroup(['A',5,1])
        sage: A==loads(dumps(A))
        True
        sage: TestSuite(A).run()

class `sage.combinat.affine_permutation.``AffinePermutationGroupTypeB`(cartan_type)

  Bases: `sage.combinat.affine_permutation.AffinePermutationGroupTypeC`

  TESTS:

      sage: AffinePermutationGroup(['A',7,1])
      The group of affine permutations of type ['A', 7, 1]

  `Element`

    alias of `AffinePermutationTypeB`

class `sage.combinat.affine_permutation.``AffinePermutationGroupTypeC`(cartan_type)

  Bases: `sage.combinat.affine_permutation.AffinePermutationGroupTypeC`

  TESTS:

      sage: AffinePermutationGroup(['A',7,1])
      The group of affine permutations of type ['A', 7, 1]

  `Element`

    alias of `AffinePermutationTypeC`

class `sage.combinat.affine_permutation.``AffinePermutationGroupTypeD`(cartan_type)

  Bases: `sage.combinat.affine_permutation.AffinePermutationGroupTypeC`

  TESTS:

      sage: AffinePermutationGroup(['A',7,1])
      The group of affine permutations of type ['A', 7, 1]

  `Element`

    alias of `AffinePermutationTypeD`

class `sage.combinat.affine_permutation.``AffinePermutationGroupTypeG`(cartan_type)

  Bases: `sage.combinat.affine_permutation.AffinePermutationGroupGeneric`

  TESTS:

      sage: AffinePermutationGroup(['A',7,1])
      The group of affine permutations of type ['A', 7, 1]

  `Element`

    alias of `AffinePermutationTypeG`

  `one`()

    Returns the identity element.

    EXAMPLES:

        sage: AffinePermutationGroup(['G',2,1]).one()
        Type G affine permutation with window [1, 2, 3, 4, 5, 6]

    TESTS:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: G==loads(dumps(G))
        True
        sage: TestSuite(G).run()

class `sage.combinat.affine_permutation.``AffinePermutationTypeA`(parent, lst, check=True)

  Bases: `sage.combinat.affine_permutation.AffinePermutation`

  Initialize `self`

  INPUT:

  - `parent` – The parent affine permutation group.
  - `lst` – List giving the base window of the affine permutation.
  - `check`– Chooses whether to test that the affine permutation is legit.

  EXAMPLES:

      sage: A=AffinePermutationGroup(['A',7,1])
      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9]) #indirect doctest
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `apply_simple_reflection_left`(i)

    Applies simple reflection to the values \(i\), \(i+1\).

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.apply_simple_reflection_left(3)
        Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]
        sage: p.apply_simple_reflection_left(11)
        Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]

  `apply_simple_reflection_right`(i)

    Applies the simple reflection to positions \(i\), \(i+1\). \(i\) is allowed to be any integer.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.apply_simple_reflection_right(3)
        Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
        sage: p.apply_simple_reflection_right(11)
        Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]

  `check`()

    Check that `self` is an affine permutation.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p
        Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]
        sage: q=A([1,2,3])
        Traceback (most recent call last):
        ...
        ValueError: Length of list must be k+1=8.
        sage: q=A([1,2,3,4,5,6,7,0])
        Traceback (most recent call last):
        ...
        ValueError: Window does not sum to 36.
        sage: q=A([1,1,3,4,5,6,7,9])
        Traceback (most recent call last):
        ...
        ValueError: Entries must have distinct residues.

  `flip_automorphism`()

    The Dynkin diagram automorphism which fixes \(s_0\) and reverses all other indices.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.flip_automorphism()
        Type A affine permutation with window [0, -1, 5, 4, 3, 9, 10, 6]

  `has_left_descent`(i)

    Determines whether there is a descent at \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.has_left_descent(1)
        True
        sage: p.has_left_descent(9)
        True
        sage: p.has_left_descent(0)
        True

  `has_right_descent`(i)

    Determines whether there is a descent at \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.has_right_descent(1)
        True
        sage: p.has_right_descent(9)
        True
        sage: p.has_right_descent(0)
        False

  `is_fully_commutative`()

    Determines whether `self` is fully commutative, ie, has no reduced words with a braid.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.is_fully_commutative()
        False
        sage: q=A([-3, -2, 0, 7, 9, 2, 11, 12])
        sage: q.is_fully_commutative()
        True

  `maximal_cyclic_decomposition`(typ='decreasing', side='right', verbose=False)

    Finds the unique maximal decomposition of `self` into cyclically decreasing/increasing elements.

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing’ (default: ‘decreasing’.) Chooses whether to find increasing or deacreasing sets.
    - `side` – ‘right’ or ‘left’ (default: ‘right’.) Chooses whether to find maximal sets starting from the left or the right.
    - `verbose` – Print extra information while finding the decomposition.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.maximal_cyclic_decomposition()
        [[0, 7], [4, 1, 0], [7, 5, 4, 2, 1]]
        sage: p.maximal_cyclic_decomposition(side='left')
        [[1, 0, 7, 5, 4], [1, 0, 5], [2, 1]]
        sage: p.maximal_cyclic_decomposition(typ='increasing', side='right')
        [[1], [5, 0, 1, 2], [4, 5, 7, 0, 1]]
        sage: p.maximal_cyclic_decomposition(typ='increasing', side='left')
        [[0, 1, 2, 4, 5], [4, 7, 0, 1], [7]]

    TESTS:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: S=p.maximal_cyclic_decomposition()
        sage: p==prod(A.from_word(l) for l in S)
        True
        sage: S=p.maximal_cyclic_decomposition(typ='increasing', side='left')
        sage: p==prod(A.from_word(l) for l in S)
        True
        sage: S=p.maximal_cyclic_decomposition(typ='increasing', side='right')
        sage: p==prod(A.from_word(l) for l in S)
        True
        sage: S=p.maximal_cyclic_decomposition(typ='decreasing', side='right')
        sage: p==prod(A.from_word(l) for l in S)
        True

  `maximal_cyclic_factor`(typ='decreasing', side='right', verbose=False)

    For an affine permutation \(x\), finds the unique maximal subset \(A\) of the index set such that \(x=yd_A\) is a reduced product.

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing.’ Determines the type of maximal cyclic element found.
    - `side` – ‘right’ or ‘left’.
    - `verbose` – True or False. If True, outputs information about how the cyclically increasing element was found.

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.maximal_cyclic_factor()
        [7, 5, 4, 2, 1]
        sage: p.maximal_cyclic_factor(side='left')
        [1, 0, 7, 5, 4]
        sage: p.maximal_cyclic_factor('increasing','right')
        [4, 5, 7, 0, 1]
        sage: p.maximal_cyclic_factor('increasing','left')
        [0, 1, 2, 4, 5]

  `position`(i)

    Find the position \(j\) such the `self.value(j)=i`

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.position(3)
        1
        sage: p.position(11)
        9

  `promotion`()

    The Dynkin diagram automorphism which sends \(s_i\) to \(s_{i+1}\).

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.promotion()
        Type A affine permutation with window [2, 4, 0, 1, 7, 6, 5, 11]

  `tableau_of_word`(w, typ='decreasing', side='right', alpha=None)

    Finds a tableau on the Lehmer code of `self` corresponding to the given reduced word.

    For a full description of this algorithm, see [D2012].

    INPUT:

    - `w` – a reduced word for self.
    - `typ` – ‘increasing’ or ‘decreasing.’ The type of Lehmer code used.
    - `side` – ‘right’ or ‘left.’
    - `alpha` – A content vector. w should be of type alpha. Specifying alpha produces semistandard tableaux.

    REFERENCES:

    [D2012] | tom denton. Canonical Decompositions of Affine Permutations, Affine Codes, and Split \(k\)-Schur Functions. Electronic Journal of Combinatorics, 2012.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.tableau_of_word(p.reduced_word())
        [[], [1, 6, 9], [2, 7, 10], [], [3], [4, 8], [], [5]]
        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: w=p.reduced_word()
        sage: w
        [0, 7, 4, 1, 0, 7, 5, 4, 2, 1]
        sage: alpha=[5,3,2]
        sage: p.tableau_of_word(p.reduced_word(), alpha=alpha)
        [[], [1, 2, 3], [1, 2, 3], [], [1], [1, 2], [], [1]]
        sage: p.tableau_of_word(p.reduced_word(), side='left')
        [[1, 4, 9], [6], [], [], [3, 7], [8], [], [2, 5, 10]]
        sage: p.tableau_of_word(p.reduced_word(), typ='increasing', side='right')
        [[9, 10], [1, 2], [], [], [3, 4], [8], [], [5, 6, 7]]
        sage: p.tableau_of_word(p.reduced_word(), typ='increasing', side='left')
        [[1, 2], [4, 5, 6], [9, 10], [], [3], [7, 8], [], []]

  `to_bounded_partition`(typ='decreasing', side='right')

    Returns the \(k\)-bounded partition associated to the dominant element obtained by sorting the Lehmer code.

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing’ (default: ‘decreasing’.) Chooses whether to find increasing or deacreasing sets.
    - `side` – ‘right’ or ‘left’ (default: ‘right’.) Chooses whether to find maximal sets starting from the left or the right.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',2,1])
        sage: p=A.from_lehmer_code([4,1,0])
        sage: p.to_bounded_partition()
        [2, 1, 1, 1]

  `to_core`(typ='decreasing', side='right')

    Returns the core associated to the dominant element obtained by sorting the Lehmer code.

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing’ (default: ‘decreasing’.)
    - `side` – ‘right’ or ‘left’ (default: ‘right’.) Chooses whether to find maximal sets starting from the left or the right.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',2,1])
        sage: p=A.from_lehmer_code([4,1,0])
        sage: p.to_bounded_partition()
        [2, 1, 1, 1]
        sage: p.to_core()
        [4, 2, 1, 1]

  `to_dominant`(typ='decreasing', side='right')

    Finds the Lehmer code and then sorts it. Returns the affine permutation with the given sorted Lehmer code; this element is 0-dominant.

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing’ (default: ‘decreasing’.) Chooses whether to find increasing or deacreasing sets.
    - `side` – ‘right’ or ‘left’ (default: ‘right’.) Chooses whether to find maximal sets starting from the left or the right.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.to_dominant()
        Type A affine permutation with window [-2, -1, 1, 3, 4, 8, 10, 13]
        sage: p.to_dominant(typ='increasing', side='left')
        Type A affine permutation with window [3, 4, -1, 5, 0, 9, 6, 10]

  `to_lehmer_code`(typ='decreasing', side='right')

    Returns the affine Lehmer code.

    There are four such codes; the options `typ` and `side` determine which code is generated. The codes generated are the shape of the maximal cyclic decompositions of `self` according to the given `typ` and `side` options.

    INPUT:

    - `typ` – ‘increasing’ or ‘decreasing’ (default: ‘decreasing’.) Chooses whether to find increasing or deacreasing sets.
    - `side` – ‘right’ or ‘left’ (default: ‘right’.) Chooses whether to find maximal sets starting from the left or the right.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: CP=CartesianProduct( ('increasing','decreasing'),('left','right') )
        sage: for a in CP:
        ....:   p.to_lehmer_code(a[0],a[1])
        [2, 3, 2, 0, 1, 2, 0, 0]
        [2, 2, 0, 0, 2, 1, 0, 3]
        [3, 1, 0, 0, 2, 1, 0, 3]
        [0, 3, 3, 0, 1, 2, 0, 1]
        sage: for a in CP:
        ....:   A.from_lehmer_code(p.to_lehmer_code(a[0],a[1]), a[0],a[1])==p
        True
        True
        True
        True

  `to_type_a`()

    Returns an embedding of `self` into the affine permutation group of type A. (For Type \(A\), just returns self.)

    EXAMPLES:

        sage: p=AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.to_type_a()==p
        True

  `value`(i, base_window=False)

    Return the image of the integer `i` under this permutation.

    INPUT:

    - `base_window` – a Boolean, indicating whether \(i\) is in the base window. If True, will run a bit faster, but the method will screw up if \(i\) is not actually in the index set.

    EXAMPLES:

        sage: A=AffinePermutationGroup(['A',7,1])
        sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
        sage: p.value(1)
        3
        sage: p.value(9)
        11

class `sage.combinat.affine_permutation.``AffinePermutationTypeB`(parent, lst, check=True)

  Bases: `sage.combinat.affine_permutation.AffinePermutationTypeC`

  Initialize `self`

  INPUT:

  - `parent` – The parent affine permutation group.
  - `lst` – List giving the base window of the affine permutation.
  - `check`– Chooses whether to test that the affine permutation is legit.

  EXAMPLES:

      sage: A=AffinePermutationGroup(['A',7,1])
      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9]) #indirect doctest
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `apply_simple_reflection_left`(i)

    Applies simple reflection indexed by \(i\) on values.

    EXAMPLES:

        sage: B=AffinePermutationGroup(['B',4,1])
        sage: p=B([-5,1,6,-2])
        sage: p.apply_simple_reflection_left(0)
        Type B affine permutation with window [-5, -2, 6, 1]
        sage: p.apply_simple_reflection_left(2)
        Type B affine permutation with window [-5, 1, 7, -3]
        sage: p.apply_simple_reflection_left(4)
        Type B affine permutation with window [-4, 1, 6, -2]

  `apply_simple_reflection_right`(i)

    Applies the simple reflection indexed by \(i\) on positions.

    EXAMPLES:

        sage: B=AffinePermutationGroup(['B',4,1])
        sage: p=B([-5,1,6,-2])
        sage: p.apply_simple_reflection_right(1)
        Type B affine permutation with window [1, -5, 6, -2]
        sage: p.apply_simple_reflection_right(0)
        Type B affine permutation with window [-1, 5, 6, -2]
        sage: p.apply_simple_reflection_right(4)
        Type B affine permutation with window [-5, 1, 6, 11]

  `check`()

    Check that `self` is an affine permutation.

    EXAMPLES:

        sage: B=AffinePermutationGroup(['B',4,1])
        sage: x=B([-5,1,6,-2])
        sage: x
        Type B affine permutation with window [-5, 1, 6, -2]

  `has_left_descent`(i)

    Determines whether there is a descent at \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: B=AffinePermutationGroup(['B',4,1])
        sage: p=B([-5,1,6,-2])
        sage: [p.has_left_descent(i) for i in B.index_set()]
        [True, True, False, False, True]

  `has_right_descent`(i)

    Determines whether there is a descent at index \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: B=AffinePermutationGroup(['B',4,1])
        sage: p=B([-5,1,6,-2])
        sage: [p.has_right_descent(i) for i in B.index_set()]
        [True, False, False, True, False]

class `sage.combinat.affine_permutation.``AffinePermutationTypeC`(parent, lst, check=True)

  Bases: `sage.combinat.affine_permutation.AffinePermutation`

  Initialize `self`

  INPUT:

  - `parent` – The parent affine permutation group.
  - `lst` – List giving the base window of the affine permutation.
  - `check`– Chooses whether to test that the affine permutation is legit.

  EXAMPLES:

      sage: A=AffinePermutationGroup(['A',7,1])
      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9]) #indirect doctest
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `apply_simple_reflection_left`(i)

    Applies simple reflection indexed by \(i\) on values.

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C([-1,5,3,7])
        sage: for i in C.index_set(): x.apply_simple_reflection_left(i)
        Type C affine permutation with window [1, 5, 3, 7]
        Type C affine permutation with window [-2, 5, 3, 8]
        Type C affine permutation with window [-1, 5, 2, 6]
        Type C affine permutation with window [-1, 6, 4, 7]
        Type C affine permutation with window [-1, 4, 3, 7]

  `apply_simple_reflection_right`(i)

    Applies the simple reflection indexed by \(i\) on positions.

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C([-1,5,3,7])
        sage: for i in C.index_set(): x.apply_simple_reflection_right(i)
        Type C affine permutation with window [1, 5, 3, 7]
        Type C affine permutation with window [5, -1, 3, 7]
        Type C affine permutation with window [-1, 3, 5, 7]
        Type C affine permutation with window [-1, 5, 7, 3]
        Type C affine permutation with window [-1, 5, 3, 2]

  `check`()

    Check that `self` is an affine permutation.

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C([-1,5,3,7])
        sage: x
        Type C affine permutation with window [-1, 5, 3, 7]

  `has_left_descent`(i)

    Determines whether there is a descent at \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C([-1,5,3,7])
        sage: for i in C.index_set(): x.has_left_descent(i)
        True
        False
        True
        False
        True

  `has_right_descent`(i)

    Determines whether there is a descent at index \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C([-1,5,3,7])
        sage: for i in C.index_set(): x.has_right_descent(i)
        True
        False
        True
        False
        True

  `position`(i)

    Find the position \(j\) such the `self.value(j)=i`

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C.one()
        sage: [x.position(i) for i in range(-10,10)]==range(-10,10)
        True

  `to_type_a`()

    Returns an embedding of `self` into the affine permutation group of type \(A\).

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C([-1,5,3,7])
        sage: x.to_type_a()
        Type A affine permutation with window [-1, 5, 3, 7, 2, 6, 4, 10, 9]

  `value`(i)

    Returns the image of the integer \(i\) under this permutation.

    EXAMPLES:

        sage: C=AffinePermutationGroup(['C',4,1])
        sage: x=C.one()
        sage: [x.value(i) for i in range(-10,10)]==range(-10,10)
        True

class `sage.combinat.affine_permutation.``AffinePermutationTypeD`(parent, lst, check=True)

  Bases: `sage.combinat.affine_permutation.AffinePermutationTypeC`

  Initialize `self`

  INPUT:

  - `parent` – The parent affine permutation group.
  - `lst` – List giving the base window of the affine permutation.
  - `check`– Chooses whether to test that the affine permutation is legit.

  EXAMPLES:

      sage: A=AffinePermutationGroup(['A',7,1])
      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9]) #indirect doctest
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `apply_simple_reflection_left`(i)

    Applies simple reflection indexed by \(i\) on values.

    EXAMPLES:

        sage: D=AffinePermutationGroup(['D',4,1])
        sage: p=D([1,-6,5,-2])
        sage: p.apply_simple_reflection_left(0)
        Type D affine permutation with window [-2, -6, 5, 1]
        sage: p.apply_simple_reflection_left(1)
        Type D affine permutation with window [2, -6, 5, -1]
        sage: p.apply_simple_reflection_left(4)
        Type D affine permutation with window [1, -4, 3, -2]

  `apply_simple_reflection_right`(i)

    Applies the simple reflection indexed by \(i\) on positions.

    EXAMPLES:

        sage: D=AffinePermutationGroup(['D',4,1])
        sage: p=D([1,-6,5,-2])
        sage: p.apply_simple_reflection_right(0)
        Type D affine permutation with window [6, -1, 5, -2]
        sage: p.apply_simple_reflection_right(1)
        Type D affine permutation with window [-6, 1, 5, -2]
        sage: p.apply_simple_reflection_right(4)
        Type D affine permutation with window [1, -6, 11, 4]

  `check`()

    Check that `self` is an affine permutation.

    EXAMPLES:

        sage: D=AffinePermutationGroup(['D',4,1])
        sage: p=D([1,-6,5,-2])
        sage: p
        Type D affine permutation with window [1, -6, 5, -2]

  `has_left_descent`(i)

    Determines whether there is a descent at \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: D=AffinePermutationGroup(['D',4,1])
        sage: p=D([1,-6,5,-2])
        sage: [p.has_left_descent(i) for i in D.index_set()]
        [True, True, False, True, True]

  `has_right_descent`(i)

    Determines whether there is a descent at index \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: D=AffinePermutationGroup(['D',4,1])
        sage: p=D([1,-6,5,-2])
        sage: [p.has_right_descent(i) for i in D.index_set()]
        [True, True, False, True, False]

class `sage.combinat.affine_permutation.``AffinePermutationTypeG`(parent, lst, check=True)

  Bases: `sage.combinat.affine_permutation.AffinePermutation`

  Initialize `self`

  INPUT:

  - `parent` – The parent affine permutation group.
  - `lst` – List giving the base window of the affine permutation.
  - `check`– Chooses whether to test that the affine permutation is legit.

  EXAMPLES:

      sage: A=AffinePermutationGroup(['A',7,1])
      sage: p=A([3, -1, 0, 6, 5, 4, 10, 9]) #indirect doctest
      sage: p
      Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

  `apply_simple_reflection_left`(i)

    Applies simple reflection indexed by \(i\) on values.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: p.apply_simple_reflection_left(0)
        Type G affine permutation with window [0, 10, -7, 14, -3, 7]
        sage: p.apply_simple_reflection_left(1)
        Type G affine permutation with window [1, 9, -4, 11, -2, 6]
        sage: p.apply_simple_reflection_left(2)
        Type G affine permutation with window [3, 11, -5, 12, -4, 4]

  `apply_simple_reflection_right`(i)

    Applies the simple reflection indexed by \(i\) on positions.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: p.apply_simple_reflection_right(0)
        Type G affine permutation with window [-9, -1, -5, 12, 8, 16]
        sage: p.apply_simple_reflection_right(1)
        Type G affine permutation with window [10, 2, 12, -5, 5, -3]
        sage: p.apply_simple_reflection_right(2)
        Type G affine permutation with window [2, -5, 10, -3, 12, 5]

  `check`()

    Check that `self` is an affine permutation.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: p
        Type G affine permutation with window [2, 10, -5, 12, -3, 5]

  `has_left_descent`(i)

    Determines whether there is a descent at \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: [p.has_left_descent(i) for i in G.index_set()]
        [False, True, False]

  `has_right_descent`(i)

    Determines whether there is a descent at index \(i\).

    INPUT:

    - `i` – an integer.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: [p.has_right_descent(i) for i in G.index_set()]
        [False, False, True]

  `position`(i)

    Find the position \(j\) such the `self.value(j)=i`

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: [p.position(i) for i in p._lst]
        [1, 2, 3, 4, 5, 6]

  `to_type_a`()

    Returns an embedding of `self` into the affine permutation group of type A.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: p.to_type_a()
        Type A affine permutation with window [2, 10, -5, 12, -3, 5]

  `value`(i, base_window=False)

    Returns the image of the integer \(i\) under this permutation.

    INPUT:

    - `base_window` – a Boolean indicating whether \(i\) is between 1 and \(k+1\). If True, will run a bit faster, but the method will screw up if \(i\) is not actually in the index set.

    EXAMPLES:

        sage: G=AffinePermutationGroup(['G',2,1])
        sage: p=G([2, 10, -5, 12, -3, 5])
        sage: [p.value(i) for i in [1..12]]
        [2, 10, -5, 12, -3, 5, 8, 16, 1, 18, 3, 11]

### Navigation

- index
- modules |
- next |
- previous |
- Combinatorics »