#12453: Refactor integer vectors using ClonableIntArray Cython data structure
-------------------------------------+-------------------------------------
Reporter: nborie | Owner: nborie
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.2
Component: combinatorics | Resolution:
Keywords: Integer, vectors, | Merged in:
cython, clone, Cernay2012 | Reviewers:
Authors: Travis Scrimshaw | Work issues:
Report Upstream: N/A | Commit:
Branch: | 3008ee6a34c023370071bfe1fb324f2b479462ed
public/refactor_integer_vectors-12453| Stopgaps:
Dependencies: #10193 #14101 |
-------------------------------------+-------------------------------------
Comment (by ncohen):
Before this branch
{{{
sage: %time _=list(IntegerVectors(5,22))
CPU times: user 1.78 s, sys: 8 ms, total: 1.78 s
Wall time: 1.81 s
}}}
After the branch
{{{
sage: %time _=list(IntegerVectors(5,22))
CPU times: user 19.3 s, sys: 60 ms, total: 19.4 s
Wall time: 19.6 s
}}}
With a 5-lines code
{{{
from itertools import combinations
def integervectors(n,k):
L = n+k-1
for x in combinations(range(L),k-1):
l = [x[i] - x[i-1]-1 for i in range(1,k-1)]
l.insert(0,x[0])
l.append(L-x[-1]-1)
yield l
sage: %time _=list(integervectors(5,22))
CPU times: user 492 ms, sys: 16 ms, total: 508 ms
Wall time: 515 ms
}}}
I think this can be classified as a severe regression. Besides, it is
probably better to avoid this kind of stuff present in your branch:
{{{
for c in IntegerVectors(self.size - k, i-1):
c = list(c)
}}}
If you only want the data, don't generate complex objects in the first
place.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/12453#comment:13>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.