Nils Bruin at Simon Fraser University brought up the idea / request to compute
period matrices of plane curves to high precision. Sage has built-in
capabilities to work with arbitrary-precision complex numbers via the CC ring.
It also implements complex doubles in the the CDF ring.
In the original version of Abelfunctions I decided to use Numpy + Cython for
numerical performance. Now I’m wondering if it’s worth investigating using
native Sage datatypes instead. Below, I perform some timings between different
fast_callable declarations, where the domain is varied, and different input
datatypes: numpy.complex, CDF, and CC.
The fastest result using only native Sage datatypes is f_CDF(a_CDF, b_CDF).
This is only about x2 slower than directly during f_CDF.call_f(...) with
native C complex datatypes. (Here, f_CDF is of type Wrapper_cdf which
provides low-level access to the underlying JIT-compiled C function.) That is,
by using native C get a x2 performance increase from the fastest native Sage
version. Given that the pure-CDF version is already x100 faster than a
non-CDF implementation I don’t think it’s worth the last bit of performance if
it means easier to read code. (Not to mention, the ease of transitioning to
It will be challenging refactoring the numerics code for Sage. I will most
likely not do anything about it until I’m done with my Ph.D. but it’s worth
investigating in the future.