Many of GSL (GNU Scientific Library)’s routines are implemented in double only. When one needs the additional speed and storage advantage, there wasn’t a quick way to go to float. Here is a quick hack:
cd gsl-1.15
, editconfigure.ac
, change
AC_INIT([gsl],[1.15])
to
AC_INIT([fgsl],[1.15])
Optionally, add an optimization line to make it look like this:
AC_LANG(C)
AC_PROG_CC
AC_PROG_CPP
CFLAGS="-O3 -mtune=native"- Then, run
autoconf
./configure
(or, to install to non-default location,./configure --prefix=/home/me/local
) - Now run this cmd to do search and replace
find . -type f -print0 | xargs -0 perl -pi -e 's/long double/LONG-DOUBLE/g;s/_double/_DOUbLE/g;s/double/float/g;s/_DOUbLE/_double/g;s/LONG-DOUBLE/long double/g;s/libgsl/libfgsl/g;s|<gsl/|<fgsl/|g'
- Now you can make and install as normal
make
make install
To use it, instead of
#include <gsl/blah.h>
use:
#include <fgsl/blah.h>
When linking, instead of link with:
-lgsl
or
libgsl.a
use:
-lfgsl
or
libfgsl.a
Thanks.