#16424: is_triangular_number() speed up
-------------------------------------+-------------------------------------
Reporter: rws | Owner:
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-6.3
Component: quadratic forms | Resolution:
Keywords: | Merged in:
Authors: Ralf Stephan | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/rws/is_triangular_number___speed_up|
de05b593cb8497493ce92e742a7379bdc8bf8489
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by {'newvalue': u'Ralf Stephan', 'oldvalue': ''}):
* status: new => needs_review
* commit: => de05b593cb8497493ce92e742a7379bdc8bf8489
* author: => Ralf Stephan
Comment:
Now it's only 10x slower:
{{{
sage: timeit('l=[n for n in range(1000) if is_triangular_number(n)]')
25 loops, best of 3: 10.6 ms per loop
sage: timeit('l=[n for n in range(1000) if is_triangular_number(n)]')
25 loops, best of 3: 10.1 ms per loop
}}}
but that is because the function does more than it should, judging from
the name.
----
New commits:
||[http://git.sagemath.org/sage.git/commit/?id=de05b593cb8497493ce92e742a7379bdc8bf8489
de05b59]||{{{16424: test first if we have a triangular number at all}}}||
--
Ticket URL: <http://trac.sagemath.org/ticket/16424#comment:2>
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.