I'm developing complex implementations (taking complex argument and returning a complex value) for Bessel functions Jn and Yn. This is for my own use at the moment, but if it is useful, it can be assimilated into GSL later.
I find myself studying the current real implementation (real arguments and returning a real value) of those functions in GSL, and almost copying it line by line with just the variable types declared as "double complex" instead of "double". This seems to be unnecessary duplication of source code. So, is there any way to do generic programming in C? Perhaps something similar to template functions in C++? If some kind of generic programming technique is possible, I suppose this will be of use in implementing complex versions of many other functions as well.
signature.asc
Description: PGP signature
