Hello,

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

-- 
Tim Joseph Dumol <tim (at) timdumol (dot) com>
http://timdumol.com
-- 
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