Skip to content

much faster count for linear intervals #40171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2025

Conversation

fchapoton
Copy link
Contributor

by caching the partial order in the adequate way

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you post some timings here just for the record?

@fchapoton
Copy link
Contributor Author

Before

sage: P=posets.TamariLattice(6);P
Finite lattice containing 132 elements
sage: %time P.linear_intervals_count()
CPU times: user 551 ms, sys: 2.78 ms, total: 554 ms
Wall time: 554 ms
[132, 330, 240, 72, 16, 2]

After

sage: P=posets.TamariLattice(6);P
Finite lattice containing 132 elements
sage: %time P.linear_intervals_count()
CPU times: user 25.6 ms, sys: 4.21 ms, total: 29.8 ms
Wall time: 43.5 ms
[132, 330, 240, 72, 16, 2]

@vbraun vbraun merged commit bb6db9d into sagemath:develop Jun 1, 2025
17 of 24 checks passed
@fchapoton fchapoton deleted the faster_linear_intervals branch June 2, 2025 15:22
vbraun pushed a commit to vbraun/sage that referenced this pull request Jun 17, 2025
sagemathgh-40245: moving linear_intervals_count to hasse as iterator
    
to make them still faster ; also changed the moved method into an
iterator as this could be convenient

follow-up of previous effort in sagemath#40171

Timings :

poset of size 4800 : 18s before ; 13 after

poset of size 5300 : 24.4 s before  and17.4 s after

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#40245
Reported by: Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this pull request Jun 18, 2025
sagemathgh-40245: moving linear_intervals_count to hasse as iterator
    
to make them still faster ; also changed the moved method into an
iterator as this could be convenient

follow-up of previous effort in sagemath#40171

Timings :

poset of size 4800 : 18s before ; 13 after

poset of size 5300 : 24.4 s before  and17.4 s after

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#40245
Reported by: Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this pull request Jun 21, 2025
sagemathgh-40245: moving linear_intervals_count to hasse as iterator
    
to make them still faster ; also changed the moved method into an
iterator as this could be convenient

follow-up of previous effort in sagemath#40171

Timings :

poset of size 4800 : 18s before ; 13 after

poset of size 5300 : 24.4 s before  and17.4 s after

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#40245
Reported by: Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this pull request Jun 25, 2025
sagemathgh-40245: moving linear_intervals_count to hasse as iterator
    
to make them still faster ; also changed the moved method into an
iterator as this could be convenient

follow-up of previous effort in sagemath#40171

Timings :

poset of size 4800 : 18s before ; 13 after

poset of size 5300 : 24.4 s before  and17.4 s after

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#40245
Reported by: Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants