#2737: [with patch, positive review] add balanced_sum to Sage
--------------------------------------+-------------------------------------
Reporter: mhansen | Owner: somebody
Type: enhancement | Status: closed
Priority: minor | Milestone: sage-4.1.1
Component: basic arithmetic | Resolution: fixed
Keywords: | Reviewer: Robert Bradshaw
Author: Jason Grout, Mike Hansen | Merged: Sage 4.1.1.alpha1
--------------------------------------+-------------------------------------
Comment(by mvngu):
Replying to [comment:6 jason]:
> Some timing info for the tour, comparing balanced sum with the builtin
sum.
>
{{{
sage: a=range(10e6)
sage: %timeit sum(a)
10 loops, best of 3: 2.58 s per loop
sage: %timeit balanced_sum(a)
10 loops, best of 3: 891 ms per loop
sage: balanced_sum(a)==sum(a)
True
}}}
This is what I get on sage.math:
{{{
sage: L = range(10e6)
sage: %time sum(L);
CPU times: user 0.51 s, sys: 0.00 s, total: 0.51 s
Wall time: 0.51 s
sage: %time balanced_sum(L);
CPU times: user 0.78 s, sys: 0.00 s, total: 0.78 s
Wall time: 0.79 s
sage: %timeit sum(L);
10 loops, best of 3: 504 ms per loop
sage: %timeit balanced_sum(L);
10 loops, best of 3: 753 ms per loop
}}}
Looks like `balanced_sum()` is worse off than the built-in `sum()` for
this particular example.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2737#comment:12>
Sage <http://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
-~----------~----~----~----~------~----~------~--~---