#13166: Compute q-binomial coefficients more efficiently
---------------------------------+------------------------------------------
Reporter: arminstraub | Owner: sage-combinat
Type: enhancement | Status: new
Priority: minor | Milestone: sage-5.2
Component: combinatorics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Armin Straub | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Description changed by arminstraub:
Old description:
> Currently, q-binomials are calculated as a fraction of products of
> q-integers. With the attached patch, q-binomials are computed as a
> product of cyclotomic polynomials. This avoids reducing a fraction of
> polynomials and is significantly faster for larger q-binomial
> coefficients.
>
> Before:
> {{{
> sage: %timeit q_binomial(18,7)
> 125 loops, best of 3: 1.89 ms per loop
> sage: %timeit q_binomial(180,70)
> 5 loops, best of 3: 1.4 s per loop
> }}}
>
> After:
> {{{
> sage: %timeit q_binomial(18,7)
> 125 loops, best of 3: 2.01 ms per loop
> sage: %timeit q_binomial2(180,70)
> 25 loops, best of 3: 34.7 ms per loop
> }}}
New description:
Currently, q-binomials are calculated as a fraction of products of
q-integers. With the attached patch, q-binomials are computed as a
product of cyclotomic polynomials. This avoids reducing a fraction of
polynomials and is significantly faster for larger q-binomial
coefficients.
Before:
{{{
sage: from sage.combinat.q_analogues import *
sage: %timeit q_binomial(18,7)
125 loops, best of 3: 1.89 ms per loop
sage: %timeit q_binomial(180,70)
5 loops, best of 3: 1.4 s per loop
}}}
After:
{{{
sage: from sage.combinat.q_analogues import *
sage: %timeit q_binomial(18,7)
125 loops, best of 3: 2.01 ms per loop
sage: %timeit q_binomial2(180,70)
25 loops, best of 3: 34.7 ms per loop
}}}
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13166#comment:1>
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.