#16374: better two_squares, three_squares, four_squares for small input
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.3
      Component:  number theory      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/16374                 |  a2b31ca5ec86eaed275a854e41cb5fd7a3ce5c95
   Dependencies:  #16308             |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * status:  needs_info => needs_review


Comment:

 Hi,

 I confirm that there is no difference between "ii = i*i" and "ii -= 2*i +
 1". Anyway, I am pretty sure that this is the kind of optimization that
 gcc takes care of with the option "-O3". In the new commit there are the
 modifications relative to your comment and mine.

 New timings
 {{{
 sage: from sage.rings.arith_pyx import two_squares_pyx, three_squares_pyx,
 four_squares_pyx
 sage: timeit("for n in xrange(10000,50000): x = four_squares_pyx(n)")
 25 loops, best of 3: 11.3 ms per loop
 }}}

 About the dependencies, I am not sure whether this ticket should go before
 or after #16308...

 Vincent

--
Ticket URL: <http://trac.sagemath.org/ticket/16374#comment:7>
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.

Reply via email to