I'm developing a Mathematica package, inside of which there is a number-crunching function. It uses a list of arbitrary-precision numbers as input and it takes a lot of time to do its job.
So I've tried to implement this function in C using GMP (GNU Multiple Precision Library) and OpenMP. This implementation works faster and I decided to include it into my package using WSTP. But as far as I know, one cannot send arbitrary-precision number from Mathematica into C via WSTP. So my question is:
How can I efficiently send an arbitrary-precision number from Mathematica into C and vice versa?
My first idea was to transfer a number as a char string (GMP can create reals from strings), but this is apparently not the best way.
RawArray
object, but I don't know if it can be passed through MathLink, even if you can somehow represent a floating-point number in this way. $\endgroup$