个人工具
登录
查看“UbuntuHelp:Arpack”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:Arpack”的源代码
来自Ubuntu中文
←
UbuntuHelp:Arpack
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/Arpack%2B%2B}} {{Languages|UbuntuHelp:Arpack%2B%2B}} * ''tested with:'' Ubuntu 8.04 (Hardy Heron) and Ubuntu 9.10 (Karmic Koala) == Introduction == ARPACK is a well known collection of FORTRAN subroutines designed to compute a few eigenvalues and eigenvectors of large scale sparse matrices. ARPACK++ is a collection of classes that offers c++ programmers an interface to ARPACK. It preserves the full capability, performance, accuracy and low memory requirements of the FORTRAN package, but takes advantage of the c++ object-oriented programming environment. While in theory ARPACK++ is in the Ubuntu and in the Debian ditribution, it is an old wrapper and encounters errors with more recent compiler; it must therefore be installed and fixed manually. == Installation == === Dependencies === Prior to installing Arpack++, the following packages have to be installed: * '''gfortran''' * '''lapack2-dev''' * '''superlu3-dev''' either via '''synaptic''' or via '''apt-get''' <pre><nowiki> apt-get install libarpack2-dev libsuperlu3-dev gfortran </nowiki></pre> === Source Code === download arpack++ 1.2 (beta version) at [[UbuntuHelp: http://www.ime.unicamp.br/~chico/arpack++/ | http://www.ime.unicamp.br/~chico/arpack++/ ]] and the patch for arpac++ 1.2 at [[UbuntuHelp: http://reuter.mit.edu/index.php/software/arpackpatch/ | http://reuter.mit.edu/index.php/software/arpackpatch/ ]] in the same directory open with an editor the patch file <code><nowiki>arpack++1.2.patch.diff</nowiki></code> <pre><nowiki> gedit arpack++1.2.patch.diff </nowiki></pre> and change the (should be 9362th) line <pre><nowiki> +FORTRAN_LIBS = -lg2c </nowiki></pre> into <pre><nowiki> +FORTRAN_LIBS = -lgfortran -lgfortranbegin -lnsl </nowiki></pre> then untar arpack++ <pre><nowiki> tar -zxvf arpack++.tar.gz </nowiki></pre> and check that it is version 1.2 with the command <pre><nowiki> head -1 arpack++/README </nowiki></pre> that should return the string <pre><nowiki> ARPACK++ version 1.2. Feb 20, 2000. </nowiki></pre> now apply the patch <pre><nowiki> cp arpack++1.2.patch.diff arpack++/ cd arpack++ patch -p 1 < arpack++1.2.patch.diff </nowiki></pre> == Compiling with ARPACK++ == at this point arpack++ should be working: as it is only a c++ interface to arpack, there are no libraries but only header files to be included into your c++ code; therefore you need to compile with <pre><nowiki> -I $whereisarpack/arpack++/include </nowiki></pre> where you should substitute to <code><nowiki>$whereisarpack</nowiki></code> the place where arpack++.tar.gz has been untarred A brief tutorial is contained in the directory <code><nowiki>$whereisarpack/arpack++/doc</nowiki></code>; anyhow, besides including the arpack++ headers, you need also to link with the required numerical libraries (arpack,superlu,lapack,blas....); to do so it is useful to look at the codes contained in <code><nowiki>$whereisarpack/arpack++/examples/superlu/sym</nowiki></code> === ARPACK++ examples === To check what you need to compile, let's examine the the examples in <code><nowiki>$whereisarpack/arpack++/examples</nowiki></code> directory; in particular for finding the eigenvalues of a symmetric matrix using superlu, go to into the proper subdirectory and compile: <pre><nowiki> cd $whereisarpack/arpack++/examples/superlu/sym make </nowiki></pre> Notice that executable <code><nowiki>lsymreg</nowiki></code> is the only working example that does not core-dump; Ignore the warnings (mostly deprecated conversion from string constant to 'char*') and pay attention to thecompilation lines <pre><nowiki> g++ -g -Dlinux -I../../../include -I -Wall -ansi -pedantic-errors -I../../../examples/matrices/sym -I../../../include -c lsymreg.cc g++ -g -Dlinux -I../../../include -I -Wall -ansi -pedantic-errors -I../../../examples/matrices/sym -o lsymreg lsymreg.o /usr/lib/libsuperlu.a -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl </nowiki></pre> while the <code><nowiki>-I../../../examples/matrices/sym</nowiki></code> include is needed as the program refers to some matrix classes defined in <code><nowiki>$whereisarpack/arpack++/examples/matrices/sym</nowiki></code> needed by <code><nowiki>lsymreg</nowiki></code>, the other include <pre><nowiki> -I../../../include </nowiki></pre> and linking <pre><nowiki> /usr/lib/libsuperlu.a -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl </nowiki></pre> are the ones needed for general compilation (with '''superlu''' libraries); ~+<u>therefore the full options needed are</u>+~ <pre><nowiki> -I $whereisarpack/arpack++/include -lsuperlu -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl </nowiki></pre> As a final check try to compile by ourself <code><nowiki>lsymreg.cc</nowiki></code>: <pre><nowiki> g++ lsymreg.cc -o my_lsymreg -I $whereisarpack/arpack++/examples/matrices/sym -I $whereisarpack/arpack++/include -lsuperlu -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl </nowiki></pre> (remember to substitute to <code><nowiki>$whereisarpack</nowiki></code> the directory where ARPACK++ is) and check that the executable <code><nowiki>my_lsymreg</nowiki></code> exists and works == Links == * [http://en.wikipedia.org/wiki/Sparse_matrix/ Sparse matrices - Wikipedia] * [http://www.caam.rice.edu/software/ARPACK// ARPACK] - documentation and information * [http://www.ime.unicamp.br/~chico/arpack++/ ARPACK++] - documentation and information * [http://crd.lbl.gov/~xiaoye/SuperLU/ SuperLU] - documentation and information ---- [[category:CategoryInstallation]] [[category:CategoryScience]] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:Arpack
。