Dear Tim,

On Tue, Jan 12, 2010 at 10:58:23PM +0800, Tim Joseph Dumol wrote:
>    I've been wondering why sage.combinat.combinat.combinations still exists,
>    when sage.combinat.combination.Combinations is much faster, being native
>    Sage code, and thus not requiring GAP interfacing (also more reliable, I
>    suppose). The huge speed differnce can be seen here:
> 
>    {{{
>    sage: timeit('[Combinations(range(i), j).list() for (i, j) in
>    CartesianProduct(range(15), range(15))]')
>    5 loops, best of 3: 449 ms per loop
> 
>    sage: timeit('[combinations(range(i), j) for (i, j) in
>    CartesianProduct(range(15), range(15))]')
>    5 loops, best of 3: 4.17 s per loop
>    }}}
> 
>    `combinations` is 10x slower than `Combinations`. If compatibility needs
>    to be maintained, `combinations(mset,k)` can be defiend as an alias to
>    `Combinations(mset,k).list`.

Thanks for the report!

Could you please open a track ticket and send us a patch, with an
alias as you suggest, and possibly a deprecation warning? Note: the
following (dubious) feature advertised in 'combinations?' might be
vaguely tricky to emulate:

         sage: mset = ["d","a","v","i","d"]
         sage: combinations(mset,3)
         ['add', 'adi', 'adv', 'aiv', 'ddi', 'ddv', 'div']

Thanks in advance!

Best,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to