Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'public/combinat/bounded_affine_permutation-22187' in 8.…
Browse files Browse the repository at this point in the history
…0.b8
  • Loading branch information
Frédéric Chapoton committed May 29, 2017
2 parents c011cfa + 6b8ada7 commit c2d250a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/doc/en/reference/references/index.rst
Expand Up @@ -993,6 +993,11 @@ REFERENCES:
Sci. Publ., Hackensack, NJ, 2008. Preprint version:
:arxiv:`0710.1835`
.. [KLS2013] Allen Knutson, Thomas Lam, and David Speyer.
*Positroid Varieties: Juggling and Geometry*
Compositio Mathematica, **149** (2013), no. 10.
:arXiv:`1111.3660`.
.. [KMM2004] Tomasz Kaczynski, Konstantin Mischaikow, and Marian
Mrozek, "Computational Homology", Springer-Verlag (2004).
Expand Down
52 changes: 52 additions & 0 deletions src/sage/combinat/permutation.py
Expand Up @@ -182,6 +182,7 @@
:meth:`from_lehmer_code` | Returns the permutation with Lehmer code ``lehmer``.
:meth:`from_reduced_word` | Returns the permutation corresponding to the reduced word ``rw``.
:meth:`bistochastic_as_sum_of_permutations` | Returns a given bistochastic matrix as a nonnegative linear combination of permutations.
:meth:`bounded_affine_permutation` | Return a partial permutation representing the bounded affine permutation of a matrix.
:meth:`descents_composition_list` | Returns a list of all the permutations in a given descent class (i. e., having a given descents composition).
:meth:`descents_composition_first` | Returns the smallest element of a descent class.
:meth:`descents_composition_last` | Returns the largest element of a descent class.
Expand Down Expand Up @@ -6986,6 +6987,57 @@ def bistochastic_as_sum_of_permutations(M, check = True):

return value

def bounded_affine_permutation(A):
r"""
Return the bounded affine permutation of a matrix.
The *bounded affine permutation* of a matrix `A` with entries in `R`
is a partial permutation of length `n`, where `n` is the number of
columns of `A`. The entry in position `i` is the smallest value `j`
such that column `i` is in the span of columns `i+1, \ldots, j`,
over `R`, where column indices are taken modulo `n`.
If column `i` is the zero vector, then the permutation has a
fixed point at `i`.
INPUT:
- ``A`` -- matrix with complex entries
EXAMPLES::
sage: from sage.combinat.permutation import bounded_affine_permutation
sage: A = Matrix(QQ, [[1,0,0,0], [0,1,0,0]])
sage: bounded_affine_permutation(A)
[5, 6, 3, 4]
REFERENCES:
- [KLS2013]_
"""
n = A.ncols()
R = A.base_ring()
from sage.modules.free_module import FreeModule
from sage.modules.free_module import span
z = FreeModule(R, A.nrows()).zero()
v = A.columns()
perm = []
for j in range(n):
if v[j] == z:
perm.append(j+1)
continue
V = span([z], R)
for i in range(j+1, j+n+1):
index = i % n
V = V + span([v[index]], R)
if V == span([z], R):
continue
if v[j] in V:
perm.append(i+1)
break
S = Permutations(2*n, n)
return S(perm)


class StandardPermutations_descents(StandardPermutations_n_abstract):
"""
Permutations of `\{1, \ldots, n\}` with a fixed set of descents.
Expand Down

0 comments on commit c2d250a

Please sign in to comment.