#8159: Updated Cython backend for mpmath
---------------------------------+------------------------------------------
   Reporter:  fredrik.johansson  |       Owner:  tbd   
       Type:  enhancement        |      Status:  new   
   Priority:  major              |   Milestone:        
  Component:  performance        |    Keywords:  mpmath
     Author:  fredrik.johansson  |    Upstream:  N/A   
   Reviewer:                     |      Merged:        
Work_issues:                     |  
---------------------------------+------------------------------------------
 This update of sage.libs.mpmath, along with recent changes to mpmath
 itself and the patch in !#6199, results in a 3x overall speedup of mpmath
 (as measured by `mpmath.runtests()` performance). Elementary functions,
 hypergeometric series, and other "low-level" transcendental functions are
 not affected much, but functions that do a lot of arithmetic with mpf/mpc
 instances (examples: lambertw, polylog, bernpoly and many others;
 numerical summation, numerical integration, etc) can be 3x-10x faster. A
 similar speedup should be attainable in the future for the "low-level"
 functions by implementing those in Cython as well.

 This extension works if site-packages/mpmath is replaced with an svn trunk
 checkout. There are essentially no tests in the Cython modules themselves;
 testing can be done with

 `import mpmath; mpmath.runtests(); mpmath.doctests()`

 (There is a very small number of doctests that fail due to numerical
 noise; this is nothing to worry about.)

 This is not the final version of the code to be committed (it will
 synchronized with the next release of mpmath), but I'm uploading it to
 have a safe copy and for potential early review. I have not tested this on
 a 32-bit system. There could be some subtle overflow or memory leak issues
 that aren't caught by the tests.

 It's not thread-safe due to the use of global state (which is used mostly
 because I was lazy, but it possibly also helps performance). I don't
 consider this a serious bug since vanilla-Python mpmath isn't fully
 thread-safe either. But it should be fixed some time in the future.

 I think a number of optimizations are possible, including optimizing
 MPF_normalize and caching MPF and mpf/mpc instances. I have also not
 updated the mpmath <-> Sage conversion code, which could be improved not
 to go via tuple values.

 Sorry that it's not in the form of a patch (my current hg copy of Sage
 being dirty).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8159>
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 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.

Reply via email to