New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modernize complex_mpfr #24489
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:4
If you are going to do serious refactoring, here is a different proposal: deprecate |
comment:5
Replying to @jdemeyer:
+1. I wanted to do that at some point but Marc Mezzarobba claimed that the mpfr version was faster and hence still needed. I will be more than happy to recycle this ticket in order to do this! Though the branch in #24483 is still useful to liberate the module |
comment:6
Please keep in mind #24353 which will almost certainly change timings. Unfortunately, that ticket is current stalled because it breaks MPFI. If there is a proper release of MPC, maybe I'll try to patch MPFI in Sage. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:10
Replying to @videlec:
My bad: it was JP Flori. |
comment:12
Yes it used to be the case, and Paul Zimmerman improved MPC but my last souvenir is that for basic operations Sage's complex_mpfr was still faster than complex_mpc surely because it does not handle special cases (NaN, infinities, and i don't know what) gracefully. Things can have changed but there is only one way to knwom: benchmark both implementations, and I don't think I have any time for this. On a side note, I would think it is a very good idea to get rid of complex_mpfr if we can. |
comment:13
Replying to @jpflori:
Certainly not because of that reason. First of all, checking for a special value is really trivial compared to dealing with Python objects. You need to work with least ~100 bits of precision to have a sensible benchmark because otherwise you are only benchmarking the Python overhead anyway. |
comment:14
Replying to @jpflori:
Of course it's always going to be faster. But that's not the point. If you really want speed, use The thing that we should focus on is the correctness. With MPC, you are guaranteed that the answer that you receive is as good as it can be. With MPFR complex numbers, we are using some arbitrary formulas and we hope that everything works. On the one hand, we use an arbitrary-precision library but we cannot say whether the many bits that you get are actually meaningful. |
Similarly to #24457 for real numbers we perform some cleaning for complex numbers in view of #17713/#24457.
step 1
sage.rings.complex_field
tosage.rings.complex_mpfr
Complex Field with XX bits of precision
toComplex Floating-point Field with XX bits of precision
ComplexField
by making the classComplexField_class
inherits fromUniqueRepresentation
CompleNumber
/ComplexField
intoComplexFloatingPoint
/ComplexFloatingPointField
_prec
ofComplexNumber
(ampfr_t
carries its precision that can be obtained withmpfr_get_prec
)is_ComplexNumber(x)
/is_ComplexField(x)
in favor ofisinstance(x, ComplexFloatingPoint)
/isinstance(x, ComplexFloatingPointField)
mpfr_t
pointers in__cinit__
as it is the case for real floating point numbers inreal_mpfr.pyx
CC
in favor ofCFF
see also task ticket #17713
Depends on #24483
Depends on #24457
CC: @mezzarobba @jpflori
Component: basic arithmetic
Author: Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/24489
The text was updated successfully, but these errors were encountered: