#15193: Add _pari_() method to Factorization
---------------------------------+----------------------------
Reporter: pbruin | Owner:
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-5.12
Component: factorization | Resolution:
Keywords: pari | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------+----------------------------
Comment (by mathzeta2):
Yes, for me it is faster for factorizations with at least (about) 10
factors. Some non-scientific timings:
{{{
sage: import itertools
sage: A = factor(prod(primes(2)))
sage: %timeit reduce(lambda f, g: f+g, A, ())
1000000 loops, best of 3: 830 ns per loop
sage: %timeit tuple(itertools.chain(*A))
100000 loops, best of 3: 2.26 us per loop
sage: %timeit tuple(itertools.chain.from_iterable(A))
100000 loops, best of 3: 1.86 us per loop
sage: B = factor(prod(primes(200)))
sage: %timeit reduce(lambda f, g: f+g, B, ())
10000 loops, best of 3: 33.2 us per loop
sage: %timeit tuple(itertools.chain(*B))
10000 loops, best of 3: 20.8 us per loop
sage: %timeit tuple(itertools.chain.from_iterable(B))
10000 loops, best of 3: 20.1 us per loop
sage: C = factor(prod(primes(2000)))
sage: %timeit reduce(lambda f, g: f+g, C, ())
1000 loops, best of 3: 418 us per loop
sage: %timeit tuple(itertools.chain(*C))
10000 loops, best of 3: 119 us per loop
sage: %timeit tuple(itertools.chain.from_iterable(C))
10000 loops, best of 3: 117 us per loop
sage: len(A), len(B), len(C)
(0, 46, 303)
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15193#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 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/groups/opt_out.