Skip to content

Commit 040d852

Browse files
author
Release Manager
committed
sagemathgh-40941: provide alias number_of_longest_increasing_subsequences fix sagemath#40935 in permutation as with sagemath#40939: we have to decide whether this does not pollute the name space too much. URL: sagemath#40941 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton
2 parents c812284 + eb12ea1 commit 040d852

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/sage/combinat/permutation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
:meth:`~sage.combinat.permutation.Permutation.runs` | Return a list of the runs in the permutation ``self``.
6262
:meth:`~sage.combinat.permutation.Permutation.longest_increasing_subsequence_length` | Return the length of the longest increasing subsequences of ``self``.
6363
:meth:`~sage.combinat.permutation.Permutation.longest_increasing_subsequences` | Return the list of the longest increasing subsequences of ``self``.
64-
:meth:`~sage.combinat.permutation.Permutation.longest_increasing_subsequences_number` | Return the number of longest increasing subsequences
64+
:meth:`~sage.combinat.permutation.Permutation.number_of_longest_increasing_subsequences` | Return the number of longest increasing subsequences
6565
:meth:`~sage.combinat.permutation.Permutation.cycle_type` | Return the cycle type of ``self`` as a partition of ``len(self)``.
6666
:meth:`~sage.combinat.permutation.Permutation.foata_bijection` | Return the image of the permutation ``self`` under the Foata bijection `\phi`.
6767
:meth:`~sage.combinat.permutation.Permutation.foata_bijection_inverse` | Return the image of the permutation ``self`` under the inverse of the Foata bijection `\phi`.
@@ -2441,7 +2441,7 @@ def longest_increasing_subsequences(self) -> list:
24412441

24422442
return sorted([p[1:-1] for p in D.all_paths(0, n + 1)], reverse=True)
24432443

2444-
def longest_increasing_subsequences_number(self):
2444+
def number_of_longest_increasing_subsequences(self):
24452445
r"""
24462446
Return the number of increasing subsequences of maximal length
24472447
in ``self``.
@@ -2459,13 +2459,13 @@ def longest_increasing_subsequences_number(self):
24592459
24602460
EXAMPLES::
24612461
2462-
sage: sum(p.longest_increasing_subsequences_number()
2462+
sage: sum(p.number_of_longest_increasing_subsequences()
24632463
....: for p in Permutations(8))
24642464
120770
24652465
24662466
sage: p = Permutations(50).random_element()
24672467
sage: (len(p.longest_increasing_subsequences()) == # needs sage.graphs
2468-
....: p.longest_increasing_subsequences_number())
2468+
....: p.number_of_longest_increasing_subsequences())
24692469
True
24702470
"""
24712471
n = self.size()
@@ -2494,6 +2494,8 @@ def longest_increasing_subsequences_number(self):
24942494
count[x] += count[k]
24952495
return sum(count[x] for x in columns[-1])
24962496

2497+
longest_increasing_subsequences_number = number_of_longest_increasing_subsequences
2498+
24972499
def cycle_type(self):
24982500
r"""
24992501
Return a partition of ``len(self)`` corresponding to the cycle

0 commit comments

Comments
 (0)