Ticket #13236 (needs_work enhancement)
Elements of a specific rank of a ranked poset
| Reported by: | numata | Owned by: | tbd |
|---|---|---|---|
| Priority: | major | Milestone: | sage-5.11 |
| Component: | combinatorics | Keywords: | poset, combinatorics, sd40 |
| Cc: | sage-combinat | Work issues: | |
| Report Upstream: | N/A | Reviewers: | |
| Authors: | NUMATA, Yasuhide | Merged in: | |
| Dependencies: | Stopgaps: |
Description (last modified by numata) (diff)
For a ranked poset P and its rank function r. Implement the following:
- method which returns iterator of elements p in P such that r(p)=k.
- method which returns the list of elements p in P such that r(p)=k.
(Temporary names of them are elements_of_the_rank_iterator and elements_of_the_rank)
Attachments
Change History
Changed 11 months ago by numata
comment:2 Changed 11 months ago by numata
- Status changed from new to needs_review
- Description modified (diff)
comment:4 Changed 7 months ago by hthomas
You have "rertuns" in the doc strings (twice).
Examples should be preceded by "EXAMPLES::" (all caps) not "Examples::"
You introduce some lines which have only blank spaces in them. It is preferable not to do this --- a blank line should consist only of a return character. (There are places where this convention is not adhered to in current Sage code. Don't try to fix this in old code, as it is likely to lead to conflicts with other patches, but it's good practice to follow this convention when writing new code.)
At the moment, is_ranked is implemented by calling rank_function and checking whether the result in "None". In order to avoid calling this method twice, it would probably be better to define r as you do, then check whether or not it is None yourself.


For whatever it's worth: you might want to use sage.misc.misc.fibers (in the Sage-Combinat queue), applied to the rank function, for a quick implementation.