#20008: Implement non-recursive iterator for compositions
-------------------------------------+-------------------------------------
Reporter: tscrim | Owner: sage-combinat
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-7.1
Component: combinatorics | Resolution:
Keywords: iterator | Merged in:
Authors: Travis Scrimshaw | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
public/combinat/composition_iterator-20008|
c6ba3e7f4d3414877fdce12128d36b40bd5e7834
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by tscrim):
Replying to [comment:6 tscrim]:
> Replying to [comment:5 darij]:
> > Grammar error in doc.
How about this?
> > What is the logic behind the algorithm anyway?
>
> The idea is to find the lex smallest composition by adding a box each
step. If we have a composition of `n`, then yield and remove the last
column and add a box to the new final column. Otherwise add a box to the
end. Hmmm....implementing it directly from that would probably be a little
cleaner since `cur` would always be a valid partition. Let me change that
now.
Actually, now I remember why I did it how it is, so I wouldn't have to
check that `cur` is non-empty when I did my backtracking.
--
Ticket URL: <http://trac.sagemath.org/ticket/20008#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.