Pre-processing large mathematical expressions for gmp?
Torbjorn Granlund
tg at gmplib.org
Tue Jun 15 10:40:36 CEST 2010
Jim Skea <jimskea at gmail.com> writes:
Does anyone know of a pre-processor that would take a long mathematical
expression and convert it into the equivalent set of gmp function calls,
creating any temporary variables as necessary?
Something that would take, as a small example
y = y + h6*(k1+2*k2+2*k3+k4)
and produce
mpf_mul_ui(t0, k3, 2);
mpf_mul_ui(t1, k2, 2);
mpf_add(t2,t0,t1);
mpf_add(t3,t2,k1);
mpf_add(t4,t3,k4);
mpf_mul(t5,t4,h6);
mpf_add(y, y, t5);
If you don't mind writing in C++, the GMP C++ wrapper (which is
distributed with GMP) will do this for you.
--
Torbjörn
More information about the gmp-discuss
mailing list