#4446: [with patches, needs work] New module complex_mpc using lib mpc for 
complex
multiprecision arithmetic
---------------------------------+------------------------------------------
   Reporter:  thevenyp           |       Owner:  mabshoff  
       Type:  enhancement        |      Status:  needs_work
   Priority:  major              |   Milestone:  sage-4.3.1
  Component:  optional packages  |    Keywords:            
Work_issues:                     |      Author:            
   Upstream:  N/A                |    Reviewer:            
     Merged:                     |  
---------------------------------+------------------------------------------
Changes (by ylchapuy):

  * upstream:  => N/A


Comment:

 With the updated patch, and the corresponding spkg available at
 http://yann.laiglechapuy.net/spkg/mpc-0.8.1.p0.spkg
 almost every methods for ComplexNumbers are defined for MPComplexNumbers
 to.

 The performance is quite good:
 with a precision of 500bits,

 {{{
 ==========
 add
 ComplexField: a+b 40000 loops, best of 5: 700 ns per loop
 MPComplexField: m+n 40000 loops, best of 5: 755 ns per loop
 ==========
 add int
 ComplexField: a+17 40000 loops, best of 5: 2.75 µs per loop
 MPComplexField: m+17 40000 loops, best of 5: 2.43 µs per loop
 ==========
 mul
 ComplexField: a*b 40000 loops, best of 5: 2.66 µs per loop
 MPComplexField: m*n 40000 loops, best of 5: 2.68 µs per loop
 ==========
 div
 ComplexField: a/b 40000 loops, best of 5: 5.76 µs per loop
 MPComplexField: m/n 40000 loops, best of 5: 10.7 µs per loop
 ==========
 real
 ComplexField: a.real() 40000 loops, best of 5: 1.7 µs per loop
 MPComplexField: m.real() 40000 loops, best of 5: 764 ns per loop
 ==========
 conj
 ComplexField: a.conjugate() 40000 loops, best of 5: 756 ns per loop
 MPComplexField: m.conjugate() 40000 loops, best of 5: 633 ns per loop
 ==========
 arg
 ComplexField: a.argument() 2000 loops, best of 5: 104 µs per loop
 MPComplexField: m.argument() 2000 loops, best of 5: 102 µs per loop
 ==========
 cos
 ComplexField: a.cos() 2000 loops, best of 5: 57.2 µs per loop
 MPComplexField: m.cos() 2000 loops, best of 5: 86.4 µs per loop
 ==========
 pow
 ComplexField: a**b 2000 loops, best of 5: 240 µs per loop
 MPComplexField: m**n 2000 loops, best of 5: 515 µs per loop
 ==========
 pow int
 ComplexField: a**12345 2000 loops, best of 5: 55.1 µs per loop
 MPComplexField: m**12345 2000 loops, best of 5: 549 µs per loop
 ==========
 log
 ComplexField: a.log() 4000 loops, best of 5: 177 µs per loop
 MPComplexField: m.log() 4000 loops, best of 5: 153 µs per loop
 ==========
 exp
 ComplexField: a.exp() 10000 loops, best of 5: 53.7 µs per loop
 MPComplexField: m.exp() 10000 loops, best of 5: 57.5 µs per loop
 }}}

 The only big slow down is for `pow`.

 It also allows to compute various trigonometric functions without
 convertion to pari.

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