help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Generic programming in C


From: Arun Isaac
Subject: [Help-gsl] Generic programming in C
Date: Mon, 09 Nov 2015 01:00:33 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]