replace_powers does string manipulation
replace_powers.RdThis function takes a string argument with human readable math
(e.g. R code), and replaces the power operator z^n with
C-compatible function calls: pow(x,n), it counts parentheses to
determine the base and exponent automatically.
Details
This functions assumes that gsl functions can be used, the GNU
Scientific Library includes powers of small integers. These
functions may be faster than always calling pow from math.h.
This is necessary because in C the ^ operator means something
else (exclusive bitwise xor for integers). No attempt will be made
to cast the numbers to float or double.