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

Add IteratorOfPartitionsSet an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets #4074

Merged
merged 2 commits into from
Jul 21, 2020

Conversation

jesselansdown
Copy link
Contributor

@jesselansdown jesselansdown commented Jul 14, 2020

Description

Added an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets

Text for release notes

Added an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets

Checklist for pull request reviewers

  • proper formatting

  • usage of relevant labels

    1. either release notes: not needed or release notes: to be added
    2. at least one of the labels bug or enhancement or new feature
    3. for changes meant to be backported to stable-4.X add the backport-to-4.X label
    4. consider adding any of the labels build system, documentation, kernel, library, tests
  • runnable tests

  • lines changed in commits are sufficiently covered by the tests

  • adequate pull request title

  • well formulated text for release notes

  • relevant documentation updates

  • sensible comments in the code

@jesselansdown jesselansdown changed the title Iterator of partitions set Added IteratorOfPartitionsSet Jul 14, 2020
@DominikBernhardt DominikBernhardt added kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: library release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Jul 14, 2020
@coveralls
Copy link

coveralls commented Jul 14, 2020

Coverage Status

Coverage increased (+0.001%) to 84.884% when pulling 6ac92e4 on jesselansdown:IteratorOfPartitionsSet into 9c8df14 on gap-system:master.

lib/combinat.gi Outdated Show resolved Hide resolved
Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Thank you very much for your contribution. I have some minor, optional suggestions; but one thing is rather important to me: please give a reference for the algorithm, and/or an explanation for what it does.

Error( "<s> must be a set" );
fi;

nextIterator := function(iter)
Copy link
Member

Choose a reason for hiding this comment

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

Could you please insert a comment which explains what this algorithm is? E.g. if it has a name, give that; if there is a reference, give that?

I know that a lot of existing code doesn't that kind of thing either -- but I think that's a major issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a description. Is this satisfactory?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, just the mention of "restricted growth strings" is super helpful, as that allowed me to find papers discussing it, and also find it in TAOCP Volume 4A by Knuth.

I've taken the liberty of squashing your commits and fixing a few more formatting issues and typos. I also change s := s to s := Immutable(s), to be resilient against changes to the input set during the iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome, cheers!

lib/combinat.gi Outdated Show resolved Hide resolved
lib/combinat.gi Outdated Show resolved Hide resolved
jesselansdown and others added 2 commits July 21, 2020 17:06
Returns an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets
Copy link
Member

@fingolfin fingolfin 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 be merged once tests passed.

@fingolfin fingolfin merged commit ebdb473 into gap-system:master Jul 21, 2020
@jesselansdown jesselansdown deleted the IteratorOfPartitionsSet branch July 22, 2020 09:22
@PaulaHaehndel PaulaHaehndel self-assigned this Feb 16, 2021
@PaulaHaehndel PaulaHaehndel changed the title Added IteratorOfPartitionsSet Added IteratorOfPartitionsSet an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets Feb 16, 2021
@PaulaHaehndel PaulaHaehndel added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Feb 16, 2021
@PaulaHaehndel PaulaHaehndel removed their assignment Feb 16, 2021
@PaulaHaehndel PaulaHaehndel changed the title Added IteratorOfPartitionsSet an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets Add IteratorOfPartitionsSet an iterator for all unordered partitions of a set into pairwise disjoint nonempty sets Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements kind: new feature release notes: added PRs introducing changes that have since been mentioned in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants