gsl 安装以及运行

1.主页
http://www.gnu.org/software/gsl/

2.下载源码及manual
ftp://ftp.gnu.org/gnu/gsl/gsl-1.7.tar.gz
http://www.gnu.org/software/gsl/manual/gsl-ref.ps.gz

3.编译安装
(我用的是FC4)
./configure –diable-shared
make
make install

4.测试
4.1写个testgsl.c:
#include stdio.h;
#include gsl/gsl_sf_bessel.h;

int main(void)
{
double x = 5.0;
double y = gsl_sf_bessel_J0(x);
printf(“J0(%g) = %.18e\n”,x,y);
return 0;
}

4.2编译
gcc -Wall -c testgsl.c

4.3链接
gcc -o testgsl testgsl.o -lgsl -lgslcblas -lm

4.4运行
./testgsl
输出:
J0(5) = -1.775967713143382920e-01

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s