因为要计算矩阵特征值,要调用arpack,安装了源里面的libarpack,却不知道怎么调用,请教达人
参考中科大bbs上一个帖子把问题解决了
1、在新得利里面搜索arpack,下载后安装
2、在终端输入whereis libarpack
我的机器上得的结果:
libarpack: /usr/lib/libarpack.a /usr/lib/libarpack.so
用第一个路径
3、去http://www.caam.rice.edu/software/ARPACK/ 下载arpack96.tar.gz
4、终端中输入tar xzvf arpack96.tar.gz
5、cd ARPACK/EXAMPLES/NONSYM
6、输入gfortran dndrv1.f -L/usr/lib -larpack -o ss
举例:如果程序aaa.f要调用/dir/lib/lib***.a (我的机器上路径是/usr/lib/libarpack.a)
编译时写作 gfortran aaa.f -L/dir/lib -l*** -o -ss
7、执行./ss
8、得到结果
Ritz values (Real,Imag) and relative residuals
----------------------------------------------
Col 1 Col 2 Col 3
Row 1: 1.96054E+01 0.00000E+00 1.94458E-14
Row 2: 7.68333E+01 0.00000E+00 4.23099E-15
Row 3: 4.82193E+01 0.00000E+00 7.80421E-15
Row 4: 4.82193E+01 0.00000E+00 6.98407E-15
_NDRV1
======
Size of the matrix is 100
The number of Ritz values requested is 4
The number of Arnoldi vectors generated (NCV) is 20
What portion of the spectrum: SM
The number of converged Ritz values is 4
The number of Implicit Arnoldi update iterations taken is 9
The number of OP*x is 139
*********************************************************************************
说明调用成功了
附注:1、网上有关于安装arpack的帖子,不过比较复杂,不推荐使用,源里面有现成的可以用
2、其他软件包没有尝试过,希望拍砖
[问题]新得利软件包里面的libarpack如何调用呢?(已解决)
-
- 帖子: 33
- 注册时间: 2006-12-15 18:17
-
- 帖子: 700
- 注册时间: 2006-10-18 15:48
-
- 帖子: 700
- 注册时间: 2006-10-18 15:48
-
- 帖子: 700
- 注册时间: 2006-10-18 15:48