注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

一粒浮尘

飘渺虚无

 
 
 

日志

 
 

How to install GSL on linux(ubuntu)  

2010-05-27 13:26:04|  分类: work |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
The GNU Scientific Library is an open source (GPL) library of useful routines for scientific and numerical computing. It will (should) build on ony system with an ANSI C compiler.

Using GSL on the department Linux machines
I did this istallation on atlas, which is running Linux on Intel and has gcc installed. Results may (but shouldn't) be different on one of the Sun machines like zeus.

the current version of GSL and place the file in your home directory. This tutorial assumes version 1.7, so change filenames as appropriate.
Unpack the file with the following command:

tar -zxvf gsl-1.7.tar.gz
This will create a directory called gsl-1.7 in your home directory. Change to this directory.
cd gsl-1.7
The next step is to configure the installation and tell the system where to install the files. I have a directory called "dev" in my home directory that I use for this sort of thing. These instructions will install the files in the directory /home/steve/dev.

First, create the dev directory.

mkdir /home/steve/dev
Now configure the installation and tell it to use your new directory. This step may take a minute.
./configure --prefix=/home/steve/dev
If there are no errors, compile the library. This step will take several minutes.
make
Now it is a good idea to test the library before actually installing it. Again, this step will take some time.
make check
If there are no errors, go ahead and install the library.
make install
Now we can write a test program to see if the library works. Create the following program and name it example.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;
}
Compile and link the program with the following commands (but use the correct path for your username):
gcc -Wall -I/home/steve/dev/include -c example.c
gcc -L/home/steve/dev/lib example.o -lgsl -lgslcblas -lm
Now try running your program!
./a.out
You should get the following output:
J0(5) = -1.775967713143382920e-01
Now that you have the GSL installed, you can remove the gsl-1.7 directory that was created in your home directory. If you have questions, feel free to email me.
  评论这张
 
阅读(1752)| 评论(1)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017