#4446: [with patches, needs work] New module complex_mpc using lib mpc for
complex
multiprecision arithmetic
-------------------------------+--------------------------------------------
Reporter: thevenyp | Owner: mabshoff
Type: enhancement | Status: new
Priority: major | Milestone: sage-3.4.1
Component: optional packages | Resolution:
Keywords: |
-------------------------------+--------------------------------------------
Changes (by was):
* summary: [with patches, needs review] New module complex_mpc using lib
mpc for complex multiprecision arithmetic =>
[with patches, needs work] New module
complex_mpc using lib mpc for complex
multiprecision arithmetic
Comment:
REFEREE REPORT:
1. How can this be optional? If the patch is applied then this is
included:
{{{
625 Extension('sage.rings.complex_mpc',
626 sources = ['sage/rings/complex_mpc.pyx'],
627 libraries = ['mpc', 'mpfr', 'gmp']), \
628
}}}
So the only way I can see this going in like this is if it is standard.
Am I missing something (probably)?
2. Timings on Xeon 2.6Ghz (sage.math). Multiplication is faster with
mpc, but addition is significantly *slower*:
{{{
sage: K = MPComplexField(53)
sage: a = K(3.3902384)
sage: b = CC(3.3902384)
sage: timeit('a*a')
625 loops, best of 3: 376 ns per loop
sage: timeit('b*b')
625 loops, best of 3: 466 ns per loop
sage: timeit('a+a')
625 loops, best of 3: 368 ns per loop
sage: timeit('b+b')
625 loops, best of 3: 304 ns per loop
}}}
3. Powering doesn't work for mpc but it does for the current CC:
{{{
sage: a**a
boom
}}}
4. Default rounding on coercion (or something?!) is different between MPC
and CC:
{{{
sage: MPComplexField(100)(3.3902384)
3.3902383999999998742680418218 + 0.00000000000000000000000000000*I
sage: ComplexField(100)(3.3902384)
3.3902384000000000000000000000
}}}
5. With higher precision and nontrivial imaginary part, the timings are
*all* in favor of the existing ComplexField already in Sage:
{{{
sage: K = MPComplexField(1000)
sage: a = K(3.3902384,9203483)
sage: b = ComplexField(1000)(3.3902384,9203483)
sage: a
3.39023839999999987426804182177875190973281860351562500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
9.20348300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e6*I
sage: b
3.39023840000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
9.20348300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e6*I
sage: timeit('a*a')
625 loops, best of 3: 2.27 µs per loop
sage: timeit('b*b')
625 loops, best of 3: 2.2 µs per loop
sage: timeit('a+a')
625 loops, best of 3: 515 ns per loop
sage: timeit('b+b')
625 loops, best of 3: 445 ns per loop
sage: timeit('a.sin()')
^P625 loops, best of 3: 221 µs per loop
sage: timeit('b.sin()')
625 loops, best of 3: 130 µs per loop
}}}
Thus until the above issues are addressed, I see no point in mpc going
into sage.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4446#comment:9>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---