Skip to content

Commit bb6db9d

Browse files
author
Release Manager
committed
gh-40171: much faster count for linear intervals by caching the partial order in the adequate way ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40171 Reported by: Frédéric Chapoton Reviewer(s): Travis Scrimshaw
2 parents 95adbfc + dd6dcd7 commit bb6db9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sage/combinat/posets/posets.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,6 +2772,10 @@ def linear_intervals_count(self) -> list[int]:
27722772
"""
27732773
if not self.cardinality():
27742774
return []
2775+
# precomputation helps for speed:
2776+
if self.cardinality() > 60:
2777+
self.lequal_matrix()
2778+
27752779
H = self._hasse_diagram
27762780
stock = [(x, x, x) for x in H]
27772781
poly = [len(stock)]

0 commit comments

Comments
 (0)