Complex number arithmetic
vegard at peltkore.net
Thu May 3 21:40:26 CEST 2007
I am not sure if this is needed or wanted, but I keep finding myself
wanting to do complex-number arithmetic with MP, so I've written a very
simple GMP add-on for complex numbers.
I've introduced a new type, the mpc_t, which contains two rational numbers
for the real and imaginary parts. The related functions work pretty much
like the rest of the library, though I might have missed a few (such as
conversion to string, which I didn't get my head around).
The library is meant to be used as a part of GMP, but I've defined a new
header, gmp.h, in order not to modify any core GMP files. Programs may
include <complex.h> beforehand to get the conversion functions between
mpc_t and the C99 complex type.
The source code is located at:
(click on "snapshot" for a tarball download, or "tree" to just browse).
I'll be happy to receive comments and/or suggestions :)
More information about the gmp-devel