#9941: faster multinomial_coefficients
----------------------------------+-----------------------------------------
   Reporter:  pernici             |       Owner:  AlexGhitza
       Type:  enhancement         |      Status:  needs_work
   Priority:  minor               |   Milestone:  sage-4.6.1
  Component:  basic arithmetic    |    Keywords:            
     Author:  Yann Laigle-Chapuy  |    Upstream:  N/A       
   Reviewer:                      |      Merged:            
Work_issues:                      |  
----------------------------------+-----------------------------------------
Changes (by fwclarke):

  * status:  needs_review => needs_work


Comment:

 I've tested this, and confirmed that the "even_faster" patch is indeed
 significantly faster and delivers correct results.  It's ''almost'' a
 positive review, except for two minor things:

 1. Erroneous results are returned if `m` is zero. E.g.,

  *
 {{{
 sage: multinomial_coefficients(0, 3)
 {(3,): 1}
 }}}

 To be consistent with `multinomial([])`, which returns `1`,
 `multinomial_coefficients(0, n)` should return `{(), 1)}` if `n` is zero,
 and `{}` otherwise.

 2. I don't understand the comment "`the very first step was mixed above"`,
 the word ''mixed'' in particular.

 One other thing that might be worth changing would be to allow
 `multinomial` to take a tuple as its argument.  Then
 `multinomial_coefficients` could have a doctest like

 {{{
 sage: r = multinomial_coefficients(4, 3)
 sage: all(multinomial(k) == v for k, v in r.items())
 True
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9941#comment:4>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to