主题:求一个用arpck写的求矩阵特征值和特征矢量的程序实例(搞定有偿)
tianhy2010 [专家分:60] 发布于 2012-10-28 17:11:00
arpack弄了好久也没通过,像个办法,把它的子程序都贴到我的程序后面算了。谁有写过这样的子程序啊?我只要一个很小的程序,3*3的矩阵都行的,只要告诉我它都调用了哪些子程序就可以了。
arpack也有自带的,但是里面的参数条条太多了。看了就头晕啊。这是他自带的子程序,里面参数太多,搞不定啊。
program znsimp
c
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This code may be used to understand basic usage of ARPACK
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c eigenvalue problem:
c
c A*x = lambda*x
c
c where A is a general n by n complex matrix.
c
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c eigenvalues of largest magnitude. Other options
c are available.
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine ZNAUPD
c that computes the quantities needed to construct
c the desired eigenvalues and eigenvectors(if requested).
c
c 3) How to extract the desired eigenvalues and eigenvectors
c using the ARPACK routine ZNEUPD.
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c and to supply a matrix-vector product
c
c w <- Av
c
c in place of the call to AV( ) below.
c
c
c Once usage of this routine is understood, you may wish to explore
c the other available options to improve convergence, to solve generalized
c problems, etc. Look at the file ex-complex.doc in DOCUMENTS directory.
c This codes implements
c
c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c ... OP = A and B = I.
c ... Assume "call av (nx,x,y)" computes y = A*x
c ... Use mode 1 of ZNAUPD.
c
c\BeginLib
c
c\Routines called
c znaupd ARPACK reverse communication interface routine.
c zneupd ARPACK routine that returns Ritz values and (optionally)
c Ritz vectors.
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c dznrm2 Level 1 BLAS that computes the norm of a complex vector.
c zaxpy Level 1 BLAS that computes y <- alpha*x+y.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: %Z%
c FILE: %M% SID: %I% DATE OF SID: %G% RELEASE: %R%
c
c\Remarks
c 1. None
c
c\EndLib
c---------------------------------------------------------------------------
c
arpack也有自带的,但是里面的参数条条太多了。看了就头晕啊。这是他自带的子程序,里面参数太多,搞不定啊。
program znsimp
c
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This code may be used to understand basic usage of ARPACK
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c eigenvalue problem:
c
c A*x = lambda*x
c
c where A is a general n by n complex matrix.
c
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c eigenvalues of largest magnitude. Other options
c are available.
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine ZNAUPD
c that computes the quantities needed to construct
c the desired eigenvalues and eigenvectors(if requested).
c
c 3) How to extract the desired eigenvalues and eigenvectors
c using the ARPACK routine ZNEUPD.
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c and to supply a matrix-vector product
c
c w <- Av
c
c in place of the call to AV( ) below.
c
c
c Once usage of this routine is understood, you may wish to explore
c the other available options to improve convergence, to solve generalized
c problems, etc. Look at the file ex-complex.doc in DOCUMENTS directory.
c This codes implements
c
c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c ... OP = A and B = I.
c ... Assume "call av (nx,x,y)" computes y = A*x
c ... Use mode 1 of ZNAUPD.
c
c\BeginLib
c
c\Routines called
c znaupd ARPACK reverse communication interface routine.
c zneupd ARPACK routine that returns Ritz values and (optionally)
c Ritz vectors.
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c dznrm2 Level 1 BLAS that computes the norm of a complex vector.
c zaxpy Level 1 BLAS that computes y <- alpha*x+y.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: %Z%
c FILE: %M% SID: %I% DATE OF SID: %G% RELEASE: %R%
c
c\Remarks
c 1. None
c
c\EndLib
c---------------------------------------------------------------------------
c
最后更新于:2012-10-28 17:08:00