-
-
Notifications
You must be signed in to change notification settings - Fork 674
Closed
Milestone
Description
The algorithm for the longest_increasing_subsequences function for permutations is currently very inefficient. I worked on a new version that vastly improves the run time of the function.
New version:
sage: %timeit Permutations(30).random_element().longest_increasing_subsequences()
19.6 ms ± 2.28 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
Old version:
sage: %timeit Permutations(30).random_element().longest_increasing_subsequences()
The slowest run took 10.40 times longer than the fastest. This could mean that an intermediate result is being cached.
3min 34s ± 2min 47s per loop (mean ± std. dev. of 7 runs, 1 loop each)
follow-up: #34218
CC: @nadialafreniere @enadeau @tscrim
Component: combinatorics
Keywords: permutation, subsequences
Author: Peter Morawitz, Finn Hulse, Nadia Lafrenière
Branch/Commit: 5969eda
Reviewer: David Coudert, Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/31451