#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|  
a796f0eb320c7955d2007486fefd2407a9bb7345
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by tscrim):

 Replying to [comment:5 darij]:
 > Grammar error in doc.
 >
 > More importantly, though, I'm not sure I understand the algorithm. Why
 does it not decrement `s` in the `s > n` case?

 Actually, that case never happens unless `n < 0`. So that could be
 removed.

 > 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.

--
Ticket URL: <http://trac.sagemath.org/ticket/20008#comment:6>
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.

Reply via email to