Skip to content
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

OrderedSetPartitions() fails for the empty set #35654

Closed
2 tasks done
maxale opened this issue May 19, 2023 · 0 comments · Fixed by #35700
Closed
2 tasks done

OrderedSetPartitions() fails for the empty set #35654

maxale opened this issue May 19, 2023 · 0 comments · Fixed by #35700
Labels
Milestone

Comments

@maxale
Copy link
Contributor

maxale commented May 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Did you read the documentation and troubleshoot guide?

  • I have read the documentation and troubleshoot guide

Environment

- **OS**: Ubuntu 22.04
- **Sage Version**: 9.8.rc0

Steps To Reproduce

OrderedSetPartitions() well supports parts of zero size.
For example, OrderedSetPartitions({1,2},[1,1,0,0]).list() gives:

[[{1}, {2}, {}, {}], [{2}, {1}, {}, {}]]

However, it does not work when the input set is empty.

Expected Behavior

For example, calling OrderedSetPartitions(set(),[0,0,0]).list() should produce the partition of the empty set into empty (sub)sets:

[[{}, {}, {}]]

Actual Behavior

However, at the moment it results in the error:

IndexError: list index out of range

Additional Information

No response

@maxale maxale added the t: bug label May 19, 2023
vbraun pushed a commit that referenced this issue Jun 3, 2023
    
### 📚 Description

The function `multiset_permutation_next_lex` was wrong on empty input
and is fixed in this PR.

Fixes #35654

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.
    
URL: #35700
Reported by: Vincent Delecroix
Reviewer(s): Frédéric Chapoton
@mkoeppe mkoeppe added this to the sage-10.1 milestone Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants