特殊:Badtitle/NS100: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) =…'创建新页面 |
(没有差异)
|
2010年5月19日 (三) 21:35的最新版本
![]() |
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Arpack%2B%2B }} |
![]() |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/af | • {{#if: UbuntuHelp:Arpack%2B%2B|Afrikaans| [[::Arpack/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ar | • {{#if: UbuntuHelp:Arpack%2B%2B|العربية| [[::Arpack/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/az | • {{#if: UbuntuHelp:Arpack%2B%2B|azərbaycanca| [[::Arpack/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/bcc | • {{#if: UbuntuHelp:Arpack%2B%2B|جهلسری بلوچی| [[::Arpack/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/bg | • {{#if: UbuntuHelp:Arpack%2B%2B|български| [[::Arpack/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/br | • {{#if: UbuntuHelp:Arpack%2B%2B|brezhoneg| [[::Arpack/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ca | • {{#if: UbuntuHelp:Arpack%2B%2B|català| [[::Arpack/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/cs | • {{#if: UbuntuHelp:Arpack%2B%2B|čeština| [[::Arpack/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/de | • {{#if: UbuntuHelp:Arpack%2B%2B|Deutsch| [[::Arpack/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/el | • {{#if: UbuntuHelp:Arpack%2B%2B|Ελληνικά| [[::Arpack/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/es | • {{#if: UbuntuHelp:Arpack%2B%2B|español| [[::Arpack/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/fa | • {{#if: UbuntuHelp:Arpack%2B%2B|فارسی| [[::Arpack/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/fi | • {{#if: UbuntuHelp:Arpack%2B%2B|suomi| [[::Arpack/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/fr | • {{#if: UbuntuHelp:Arpack%2B%2B|français| [[::Arpack/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/gu | • {{#if: UbuntuHelp:Arpack%2B%2B|ગુજરાતી| [[::Arpack/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/he | • {{#if: UbuntuHelp:Arpack%2B%2B|עברית| [[::Arpack/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/hu | • {{#if: UbuntuHelp:Arpack%2B%2B|magyar| [[::Arpack/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/id | • {{#if: UbuntuHelp:Arpack%2B%2B|Bahasa Indonesia| [[::Arpack/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/it | • {{#if: UbuntuHelp:Arpack%2B%2B|italiano| [[::Arpack/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ja | • {{#if: UbuntuHelp:Arpack%2B%2B|日本語| [[::Arpack/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ko | • {{#if: UbuntuHelp:Arpack%2B%2B|한국어| [[::Arpack/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ksh | • {{#if: UbuntuHelp:Arpack%2B%2B|Ripoarisch| [[::Arpack/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/mr | • {{#if: UbuntuHelp:Arpack%2B%2B|मराठी| [[::Arpack/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ms | • {{#if: UbuntuHelp:Arpack%2B%2B|Bahasa Melayu| [[::Arpack/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/nl | • {{#if: UbuntuHelp:Arpack%2B%2B|Nederlands| [[::Arpack/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/no | • {{#if: UbuntuHelp:Arpack%2B%2B|norsk| [[::Arpack/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/oc | • {{#if: UbuntuHelp:Arpack%2B%2B|occitan| [[::Arpack/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/pl | • {{#if: UbuntuHelp:Arpack%2B%2B|polski| [[::Arpack/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/pt | • {{#if: UbuntuHelp:Arpack%2B%2B|português| [[::Arpack/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ro | • {{#if: UbuntuHelp:Arpack%2B%2B|română| [[::Arpack/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/ru | • {{#if: UbuntuHelp:Arpack%2B%2B|русский| [[::Arpack/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/si | • {{#if: UbuntuHelp:Arpack%2B%2B|සිංහල| [[::Arpack/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/sq | • {{#if: UbuntuHelp:Arpack%2B%2B|shqip| [[::Arpack/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/sr | • {{#if: UbuntuHelp:Arpack%2B%2B|српски / srpski| [[::Arpack/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/sv | • {{#if: UbuntuHelp:Arpack%2B%2B|svenska| [[::Arpack/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/th | • {{#if: UbuntuHelp:Arpack%2B%2B|ไทย| [[::Arpack/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/tr | • {{#if: UbuntuHelp:Arpack%2B%2B|Türkçe| [[::Arpack/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/vi | • {{#if: UbuntuHelp:Arpack%2B%2B|Tiếng Việt| [[::Arpack/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/yue | • {{#if: UbuntuHelp:Arpack%2B%2B|粵語| [[::Arpack/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/zh | • {{#if: UbuntuHelp:Arpack%2B%2B|中文| [[::Arpack/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/zh-hans | • {{#if: UbuntuHelp:Arpack%2B%2B|中文(简体)| [[::Arpack/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Arpack%2B%2B | UbuntuHelp:Arpack%2B%2B | {{#if: | :}}Arpack}}/zh-hant | • {{#if: UbuntuHelp:Arpack%2B%2B|中文(繁體)| [[::Arpack/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Arpack%2B%2B|:Arpack|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Arpack/zh | | {{#ifexist: Arpack/zh | | {{#ifeq: {{#titleparts:Arpack|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Arpack|1|-1|}} | zh | | }}
* 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
apt-get install libarpack2-dev libsuperlu3-dev gfortran
Source Code
download arpack++ 1.2 (beta version) at http://www.ime.unicamp.br/~chico/arpack++/ and the patch for arpac++ 1.2 at http://reuter.mit.edu/index.php/software/arpackpatch/ in the same directory
open with an editor the patch file arpack++1.2.patch.diff
gedit arpack++1.2.patch.diff
and change the (should be 9362th) line
+FORTRAN_LIBS = -lg2c
into
+FORTRAN_LIBS = -lgfortran -lgfortranbegin -lnsl
then untar arpack++
tar -zxvf arpack++.tar.gz
and check that it is version 1.2 with the command
head -1 arpack++/README
that should return the string
ARPACK++ version 1.2. Feb 20, 2000.
now apply the patch
cp arpack++1.2.patch.diff arpack++/ cd arpack++ patch -p 1 < arpack++1.2.patch.diff
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
-I $whereisarpack/arpack++/include
where you should substitute to $whereisarpack
the place where arpack++.tar.gz has been untarred
A brief tutorial is contained in the directory $whereisarpack/arpack++/doc
; 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 $whereisarpack/arpack++/examples/superlu/sym
ARPACK++ examples
To check what you need to compile, let's examine the the examples in $whereisarpack/arpack++/examples
directory; in particular for finding the eigenvalues of a symmetric matrix using superlu, go to into the proper subdirectory and compile:
cd $whereisarpack/arpack++/examples/superlu/sym make
Notice that executable lsymreg
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
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
while the -I../../../examples/matrices/sym
include is needed as the program refers to some matrix classes defined in $whereisarpack/arpack++/examples/matrices/sym
needed by lsymreg
, the other include
-I../../../include
and linking
/usr/lib/libsuperlu.a -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl
are the ones needed for general compilation (with superlu libraries); ~+therefore the full options needed are+~
-I $whereisarpack/arpack++/include -lsuperlu -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl
As a final check try to compile by ourself lsymreg.cc
:
g++ lsymreg.cc -o my_lsymreg -I $whereisarpack/arpack++/examples/matrices/sym -I $whereisarpack/arpack++/include -lsuperlu -larpack -llapack -lblas -lgfortran -lgfortranbegin -lnsl
(remember to substitute to $whereisarpack
the directory where ARPACK++ is) and check that the executable my_lsymreg
exists and works
Links
- Sparse matrices - Wikipedia
- ARPACK - documentation and information
- ARPACK++ - documentation and information
- SuperLU - documentation and information