Last active
December 24, 2015 01:59
-
-
Save Darkdragon84/6728023 to your computer and use it in GitHub Desktop.
arpack_test_c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** program to test an interface to the arpack library | |
* | |
* Task: to calculate the eigenvalue of largest real part and the corresponding eigenvector | |
* of a real, nonsymmetric matrix A for which it is guaranteed that this eigenvalue is real and positive. | |
* | |
* to build: | |
* 1. Have an installation of arpack-ng, lapack and blas, have fortran and C++ compiler (C++11 capable) | |
* 2. Download Armadillo library http://arma.sourceforge.net/ (no installation, only include folder needed) | |
* 3. build using (where CC is e.g. g++ or icpc): CC -g -m64 -I/home/valentin/armadillo/include/ -std=c++0x -o arpack_test_c arpack_test_c.cpp -lblas -llapack -larpack | |
* 4. to run (where N*N is the total matrix dimension of A): ./arpack_test_c N | |
* | |
*/ | |
#include <iostream> | |
#include <fstream> | |
#include <functional> | |
#include <assert.h> | |
#include <armadillo> | |
using namespace std; | |
using namespace arma; | |
typedef unsigned int uint; | |
extern "C" | |
{ | |
void dnaupd_(int* IDO, char* BMAT, int* N, char WHICH[], int* NEV, double* TOL, double RESID[], int* NCV, double V[], int* LDV, int IPARAM[], int IPNTR[], double WORKD[], double WORKL[], int* LWORKL, int* INFO); | |
void dneupd_(int* RVEC, char* HOWMNY, int SELECT[], double DR[], double DI[], double Z[], int* LDZ, double* SIGMAR, double* SIGMAI, double WORKEV[], | |
char* BMAT, int* N, char WHICH[], int* NEV, double* TOL, double RESID[], int* NCV, double V[], int* LDV, int IPARAM[], int IPNTR[], double WORKD[], double WORKL[], int* LWORKL, int* INFO); | |
} | |
int eigs_rn(function<void (double*,double*)> MultOPx, int N, cx_vec& vals, cx_mat& vecs, int nev, string whch="LM", double tol=1e-15, int maxit=500, int ncv=0); | |
int eigs_rn(const mat& A, cx_vec& vals, cx_mat& vecs, int nev, string whch="LM", double tol=1e-15, int maxit=500, int ncv=0); | |
int main(int argc, char* argv[]) | |
{ | |
mat A; | |
size_t m=10; | |
int M,N; | |
double tol=1e-15; | |
string mode="LR"; | |
if (argc>1) m = atoi(argv[1]); | |
if (m==0) | |
{ | |
/// load raw packed binary, format: (int nrows, int ncols, double content[]) | |
ifstream in(string(argv[1]),fstream::binary); | |
if (!in.good()) {cout<<"could not load "<<argv[1]<<endl;abort();} | |
in.read(reinterpret_cast<char *>(&M),sizeof(int)); | |
in.read(reinterpret_cast<char *>(&N),sizeof(int)); | |
cout<<M<<"x"<<N<<endl; | |
A.set_size(M,N); | |
in.read(reinterpret_cast<char *>(A.memptr()), M*N*sizeof(double)); | |
in.close(); | |
} | |
else | |
{ | |
srand(time(NULL)); | |
A = randn(m,m); | |
A = kron(conj(A),A); | |
/// save as raw packed binary, format: (int nrows, int ncols, double content[]) | |
M=A.n_rows; | |
N=A.n_cols; | |
// cout<<m<<"x"<<n<<endl; | |
ofstream out("Amat.bin",fstream::binary); | |
out.write(reinterpret_cast<char*>(&M),sizeof(int)); | |
out.write(reinterpret_cast<char*>(&N),sizeof(int)); | |
if(A.save(out,raw_binary)) cout<<"Amat.bin saved"<<endl; | |
out.flush(); | |
out.close(); | |
} | |
cx_vec Eval1,Eval2; | |
cx_mat Evec1,Evec2; | |
int nev=4,nconv1,nconv2; | |
nconv1=eigs_rn(A,Eval1,Evec1,1,mode,tol); | |
nconv2=eigs_rn(A,Eval2,Evec2,nev,mode,tol); | |
uvec inds = sort_index(real(Eval2),1); | |
cout<<endl<<"1 dominant EV:"<<endl; | |
for (int i=0;i<nconv1;++i) cout<<Eval1(i)<<": "<<norm(A*Evec1.col(i) - Eval1(i)*Evec1.col(i),2)<<endl; | |
cout<<endl<<nev<<" dominant EV:"<<endl; | |
for (int i=0;i<nconv2;++i) cout<<Eval2(inds(i))<<": "<<norm(A*Evec2.col(inds(i)) - Eval2(inds(i))*Evec2.col(inds(i)),2)<<endl; | |
cout<<endl; | |
if (std::abs(Eval1(0) - Eval2(inds(0)))>1e-10) cout<<"FAILURE!"<<endl; | |
else cout<<"OK"<<endl; | |
return 0; | |
} | |
int eigs_rn(function<void (double*,double*)> MultOPx, int N, cx_vec& vals, cx_mat& vecs, int nev, string whch, double tol, int maxit, int ncv) | |
{ | |
vals.reset(); | |
vecs.reset(); | |
/// PARAMS FOR DNAUPD ---------------------------------------------------------------------------------------------------------// | |
int mode=1; /// standard EV problem A*x = lam*x | |
maxit=std::max(500,N); | |
int IDO=0; | |
char BMAT='I'; | |
char WHICH[3]; | |
strcpy(WHICH,whch.c_str()); | |
int NEV=nev; | |
double TOL=tol; | |
int NCV = (ncv==0) ? std::min(std::max(20,2*NEV),N) : ncv; | |
int LDV = N; | |
int LWORKL=3*NCV*(NCV + 2); | |
int IPARAM[11] = {1,0,maxit,1,0,0,mode,0,0,0,0}; | |
int IPNTR[14]; | |
// int INFONAUP=1; | |
int INFONAUP=0; | |
// vec RESID = randu<RVecType>(N); | |
vec RESID(N); | |
mat V(LDV,NCV); | |
double * WORKD = new double[3*N]; | |
double * WORKL = new double[LWORKL]; | |
// uint ct=0; | |
/// DNAUPD -------------------------------------------------------------------------------------------------------------------------// | |
while (IDO!=99) | |
{ | |
dnaupd_(&IDO,&BMAT,&N,WHICH,&NEV,&TOL,RESID.memptr(),&NCV,V.memptr(),&LDV,IPARAM,IPNTR,WORKD,WORKL,&LWORKL,&INFONAUP); | |
switch (IDO) | |
{ | |
case -1: | |
cerr<<"-1 not implemented"<<endl; | |
break; | |
case 1: /// compute Z = B * X and Y = OP * Z | |
/// For Simple EV Problem Y = Z | |
MultOPx(&WORKD[IPNTR[0]-1],&WORKD[IPNTR[1]-1]); | |
break; | |
case 2: | |
cerr<<"2 not implemented"<<endl; | |
break; | |
case 3: | |
cerr<<"3 not implemented"<<endl; | |
break; | |
case 4: | |
cerr<<"4 not implemented"<<endl; | |
break; | |
case 99:/// ARPACK HAS CONVERGED | |
break; | |
default: | |
cerr<<"IDO has unknown value"<<endl; | |
} | |
} | |
int nconv=0; | |
if (IDO==99 && INFONAUP==0) | |
{ | |
nconv=IPARAM[4]; | |
// cout<<"DNAUPD: "<<nconv<<" eigenpairs found after "<<IPARAM[2]<<" iterations"<<endl; | |
} | |
else | |
{ | |
cerr<<"no convergence in DNAUPD, on exit: "<<INFONAUP<<endl; | |
delete[] WORKD; | |
delete[] WORKL; | |
return 0; | |
} | |
/// PARAMS FOR DNEUPD -------------------------------------------------------------------------------------------------------------------------// | |
int INFONEUP=0; | |
int RVEC=1; | |
char HOWMNY='A'; | |
Col<int> SELECT(NCV); | |
SELECT.zeros(); | |
// int * SELECT = new int[NCV]; | |
vec EVR(NEV+1); | |
vec EVI(NEV+1); | |
mat Zmat(N,NEV+1); | |
double * DR = EVR.memptr(); | |
double * DI = EVI.memptr(); | |
double * Z = Zmat.memptr(); | |
int LDZ=N; | |
double SIGMAR=0., SIGMAI=0.; | |
vec WORKEV(3*NCV); | |
// double * WORKEV = new double[3*NCV]; | |
/// DNEUPD -------------------------------------------------------------------------------------------------------------------------------------// | |
dneupd_(&RVEC,&HOWMNY,SELECT.memptr(),DR,DI,Z,&LDZ,&SIGMAR,&SIGMAI,WORKEV.memptr(),&BMAT,&N,WHICH,&NEV,&TOL,RESID.memptr(),&NCV,V.memptr(),&LDV,IPARAM,IPNTR,WORKD,WORKL,&LWORKL,&INFONEUP); | |
if(INFONEUP==0) | |
{ | |
nconv=IPARAM[4]; | |
// cout<<"DNEUPD: "<<nconv<<" converged"<<endl; | |
size_t newsize=nconv; | |
EVR.resize(newsize); | |
EVI.resize(newsize); | |
vals=cx_vec(EVR,EVI); /// fill in eigenvalues | |
if (RVEC==1) | |
{ | |
vecs.set_size(N,newsize); | |
size_t i=0; | |
while (i<newsize) | |
{ | |
// cout<<vals(i)<<endl; | |
if (std::abs(EVI(i))<1e-14) | |
{ | |
// cout<<i<<" real"<<endl; | |
vecs.col(i)=cx_vec(Zmat.col(i),zeros(N)); | |
++i; | |
} | |
else | |
{ | |
// cout<<i<<" complex"<<endl; | |
vecs.col(i)=cx_vec(Zmat.col(i),Zmat.col(i+1)); | |
if (i+1<newsize) | |
{ | |
vecs.col(i+1)=cx_vec(Zmat.col(i),-Zmat.col(i+1)); | |
i+=2; | |
} | |
else ++i; | |
} | |
} | |
} | |
else vals=sort(vals,1); | |
} | |
else | |
{ | |
cerr<<"no convergence in DNEUP, on exit: "<<INFONEUP<<endl; | |
// delete[] SELECT; | |
delete[] WORKD; | |
delete[] WORKL; | |
// delete[] WORKEV; | |
return 0; | |
} | |
/// CLEAN UP | |
// delete[] SELECT; | |
delete[] WORKD; | |
delete[] WORKL; | |
// delete[] WORKEV; | |
return nconv; | |
} | |
int eigs_rn(const mat& A, cx_vec& vals, cx_mat& vecs, int nev, string whch, double tol, int maxit, int ncv) | |
{ | |
size_t m=A.n_rows; | |
assert(m==A.n_cols); | |
auto MultAx=[&A,m](double in[], double out[]) | |
{ | |
vec invec(in,m,false), outvec(out,m,false); | |
outvec = A*invec; | |
}; | |
return eigs_rn(MultAx,m,vals,vecs,nev,whch,tol,maxit,ncv); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program arpack_test | |
c /** program to test the arpack-ng library | |
c | |
c Task: to calculate the eigenvector of largest real part and the corresponding eigenvector | |
c of a real, nonsymmetric matrix A that is guaranteed, that this eigenvalue is real and positive. | |
c | |
c to build: | |
c 1. Have an installation of arpack-ng, lapack and blas, have fortran and C++ compiler (C++11 capable) | |
c 2. Have a compiled executable of arpack_test_c.cpp, that has produced a matrix 'Amat.bin' in the same folder | |
c 3. to build (where FF is e.g. gfortran or ifort): FF -g -I/path/to/arpack-ng/SRC/ -o arpack_test arpack_test.f -lblas -llapack -larpack | |
c 4. to run (a matrix file Amat.bin must be present in this directory): ./arpack_test_f | |
c 5. A dialog will ask the number nev of eigenvalues to compute | |
c 5. to change the name of the matrix, alter line 112 | |
c | |
c %-----------------------------% | |
c | Define maximum dimensions | | |
c | for all arrays. | | |
c | MAXN: Maximum dimension | | |
c | of the A allowed. | | |
c | MAXNEV: Maximum NEV allowed | | |
c | MAXNCV: Maximum NCV allowed | | |
c %-----------------------------% | |
c ===== INCLUDE DEBUG FOR TRACKING ===================== | |
include 'debug.h' | |
c ====================================================== | |
c | |
integer maxn, maxnev, maxncv, ldv | |
parameter (maxn=5000, maxnev=12, maxncv=30, ldv=maxn) | |
c | |
c %--------------% | |
c | Local Arrays | | |
c %--------------% | |
c | |
integer iparam(11), ipntr(14) | |
logical select(maxncv) | |
Double precision | |
& ax(maxn), d(maxncv,3), resid(maxn), | |
& v(ldv,maxncv), workd(3*maxn), | |
& workev(3*maxncv), | |
& workl(3*maxncv*maxncv+6*maxncv) | |
c | |
c %---------------% | |
c | Local Scalars | | |
c %---------------% | |
c | |
character bmat*1, which*2 | |
integer ido, n, nx, nev, ncv, lworkl, info, j, | |
& ierr, nconv, maxitr, ishfts, mode | |
Double precision | |
& tol, sigmar, sigmai | |
logical first, rvec | |
c | |
c %------------% | |
c | Parameters | | |
c %------------% | |
c | |
Double precision | |
& zero | |
parameter (zero = 0.0D+0) | |
c | |
c %-----------------------------% | |
c | BLAS & LAPACK routines used | | |
c %-----------------------------% | |
c | |
Double precision | |
& dlapy2, dnrm2 | |
external dlapy2, dnrm2, daxpy | |
c | |
c %--------------------% | |
c | Intrinsic function | | |
c %--------------------% | |
c | |
intrinsic abs | |
c | |
c %-----------------------% | |
c | Executable Statements | | |
c %-----------------------% | |
c | |
c %--------------------------------------------------% | |
c | The number NX is the number of interior points | | |
c | in the discretization of the 2-dimensional | | |
c | convection-diffusion operator on the unit | | |
c | square with zero Dirichlet boundary condition. | | |
c | The number N(=NX*NX) is the dimension of the | | |
c | matrix. A standard eigenvalue problem is | | |
c | solved (BMAT = 'I'). NEV is the number of | | |
c | eigenvalues to be approximated. The user can | | |
c | modify NX, NEV, NCV, WHICH to solve problems of | | |
c | different sizes, and to get different parts of | | |
c | the spectrum. However, The following | | |
c | conditions must be satisfied: | | |
c | N <= MAXN | | |
c | NEV <= MAXNEV | | |
c | NEV + 2 <= NCV <= MAXNCV | | |
c %--------------------------------------------------% | |
c | |
c ============= INSERTED LOAD ROUTINE FOR EXTERNAL MATRIX GENERATED BY ARPACK_TEST_C ====================================================================== | |
double precision, target, allocatable :: A(:,:) | |
double precision, pointer :: pA(:,:) | |
common /aptr/ pA | |
integer ios, M1, M2 | |
mneupd = 3 | |
c ========= MATRIX MUST BE IN THE SAME FOLDER !! | |
open(20, file='Amat.bin', | |
& iostat=ios,form='unformatted',access='stream', | |
& status='old',action='read') | |
if (ios==0) then | |
write(*,*) 'success' | |
read(20) M1 | |
read(20) M2 | |
if (M1 .ne. M2) then | |
write(*,*) 'matrix must be square' | |
call abort | |
else | |
M1 = M2 | |
end if | |
allocate(A(M1,M1)) | |
read(20) A | |
else | |
write(*,*) 'could not load' | |
call abort | |
end if | |
close (20) | |
pA => A | |
nx = M1 | |
n = nx | |
c========INPUT NUMBER OF WANTED EIGENPAIRS======================= | |
write(*,*) 'nev=' | |
read(*,*) nev | |
c================================================================ | |
if (nev .lt. 1 .or. nev .gt. 6) then | |
write(*,*) 'nev should be between 1 and 6, setting to 2' | |
nev = 2 | |
end if | |
if (n .lt. 20) then | |
ncv = n | |
else | |
ncv = 20 | |
end if | |
if ( n .gt. maxn ) then | |
print *, ' ERROR with _NDRV1: N is greater than MAXN ' | |
go to 9000 | |
else if ( nev .gt. maxnev ) then | |
print *, ' ERROR with _NDRV1: NEV is greater than MAXNEV ' | |
go to 9000 | |
else if ( ncv .gt. maxncv ) then | |
print *, ' ERROR with _NDRV1: NCV is greater than MAXNCV ' | |
go to 9000 | |
end if | |
bmat = 'I' | |
c======== USE LR FOR THIS MATRIX ======================================== | |
which = 'LR' | |
c | |
c %-----------------------------------------------------% | |
c | The work array WORKL is used in DNAUPD as | | |
c | workspace. Its dimension LWORKL is set as | | |
c | illustrated below. The parameter TOL determines | | |
c | the stopping criterion. If TOL<=0, machine | | |
c | precision is used. The variable IDO is used for | | |
c | reverse communication, and is initially set to 0. | | |
c | Setting INFO=0 indicates that a random vector is | | |
c | generated in DNAUPD to start the Arnoldi iteration. | | |
c %-----------------------------------------------------% | |
c | |
lworkl = 3*ncv**2+6*ncv | |
tol = zero | |
ido = 0 | |
info = 0 | |
c | |
c %---------------------------------------------------% | |
c | This program uses exact shifts with respect to | | |
c | the current Hessenberg matrix (IPARAM(1) = 1). | | |
c | IPARAM(3) specifies the maximum number of Arnoldi | | |
c | iterations allowed. Mode 1 of DNAUPD is used | | |
c | (IPARAM(7) = 1). All these options can be changed | | |
c | by the user. For details see the documentation in | | |
c | DNAUPD. | | |
c %---------------------------------------------------% | |
c | |
ishfts = 1 | |
maxitr = 300 | |
mode = 1 | |
c | |
iparam(1) = ishfts | |
iparam(3) = maxitr | |
iparam(7) = mode | |
* write (*,'(I4)') nev, ncv | |
c | |
c %-------------------------------------------% | |
c | M A I N L O O P (Reverse communication) | | |
c %-------------------------------------------% | |
c | |
10 continue | |
c | |
c %---------------------------------------------% | |
c | Repeatedly call the routine DNAUPD and take | | |
c | actions indicated by parameter IDO until | | |
c | either convergence is indicated or maxitr | | |
c | has been exceeded. | | |
c %---------------------------------------------% | |
c | |
call dnaupd ( ido, bmat, n, which, nev, tol, resid, | |
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl, | |
& info ) | |
c | |
if (ido .eq. -1 .or. ido .eq. 1) then | |
c | |
c %-------------------------------------------% | |
c | Perform matrix vector multiplication | | |
c | y <--- OP*x | | |
c | The user should supply his/her own | | |
c | matrix vector multiplication routine here | | |
c | that takes workd(ipntr(1)) as the input | | |
c | vector, and return the matrix vector | | |
c | product to workd(ipntr(2)). | | |
c %-------------------------------------------% | |
c | |
* call av (nx, workd(ipntr(1)), workd(ipntr(2))) | |
call av (M1, workd(ipntr(1)), workd(ipntr(2))) | |
c | |
c %-----------------------------------------% | |
c | L O O P B A C K to call DNAUPD again. | | |
c %-----------------------------------------% | |
c | |
go to 10 | |
c | |
end if | |
c | |
c %----------------------------------------% | |
c | Either we have convergence or there is | | |
c | an error. | | |
c %----------------------------------------% | |
c | |
if ( info .lt. 0 ) then | |
c | |
c %--------------------------% | |
c | Error message, check the | | |
c | documentation in DNAUPD. | | |
c %--------------------------% | |
c | |
print *, ' ' | |
print *, ' Error with _naupd, info = ', info | |
print *, ' Check the documentation of _naupd' | |
print *, ' ' | |
c | |
else | |
c | |
c %-------------------------------------------% | |
c | No fatal errors occurred. | | |
c | Post-Process using DNEUPD. | | |
c | | | |
c | Computed eigenvalues may be extracted. | | |
c | | | |
c | Eigenvectors may also be computed now if | | |
c | desired. (indicated by rvec = .true.) | | |
c %-------------------------------------------% | |
c | |
rvec = .true. | |
c | |
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv, | |
& sigmar, sigmai, workev, bmat, n, which, nev, tol, | |
& resid, ncv, v, ldv, iparam, ipntr, workd, workl, | |
& lworkl, ierr ) | |
c | |
c %-----------------------------------------------% | |
c | The real part of the eigenvalue is returned | | |
c | in the first column of the two dimensional | | |
c | array D, and the imaginary part is returned | | |
c | in the second column of D. The corresponding | | |
c | eigenvectors are returned in the first NEV | | |
c | columns of the two dimensional array V if | | |
c | requested. Otherwise, an orthogonal basis | | |
c | for the invariant subspace corresponding to | | |
c | the eigenvalues in D is returned in V. | | |
c %-----------------------------------------------% | |
c | |
if ( ierr .ne. 0) then | |
c | |
c %------------------------------------% | |
c | Error condition: | | |
c | Check the documentation of DNEUPD. | | |
c %------------------------------------% | |
c | |
print *, ' ' | |
print *, ' Error with _neupd, info = ', ierr | |
print *, ' Check the documentation of _neupd. ' | |
print *, ' ' | |
c | |
else | |
c | |
first = .true. | |
nconv = iparam(5) | |
do 20 j=1, nconv | |
c | |
c %---------------------------% | |
c | Compute the residual norm | | |
c | | | |
c | || A*x - lambda*x || | | |
c | | | |
c | for the NCONV accurately | | |
c | computed eigenvalues and | | |
c | eigenvectors. (iparam(5) | | |
c | indicates how many are | | |
c | accurate to the requested | | |
c | tolerance) | | |
c %---------------------------% | |
c | |
if (d(j,2) .eq. zero) then | |
c | |
c %--------------------% | |
c | Ritz value is real | | |
c %--------------------% | |
c | |
call av(nx, v(1,j), ax) | |
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1) | |
d(j,3) = dnrm2(n, ax, 1) | |
d(j,3) = d(j,3) / abs(d(j,1)) | |
c | |
else if (first) then | |
c | |
c %------------------------% | |
c | Ritz value is complex. | | |
c | Residual of one Ritz | | |
c | value of the conjugate | | |
c | pair is computed. | | |
c %------------------------% | |
c | |
call av(nx, v(1,j), ax) | |
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1) | |
call daxpy(n, d(j,2), v(1,j+1), 1, ax, 1) | |
d(j,3) = dnrm2(n, ax, 1) | |
call av(nx, v(1,j+1), ax) | |
call daxpy(n, -d(j,2), v(1,j), 1, ax, 1) | |
call daxpy(n, -d(j,1), v(1,j+1), 1, ax, 1) | |
d(j,3) = dlapy2( d(j,3), dnrm2(n, ax, 1) ) | |
d(j,3) = d(j,3) / dlapy2(d(j,1),d(j,2)) | |
d(j+1,3) = d(j,3) | |
first = .false. | |
else | |
first = .true. | |
end if | |
c | |
20 continue | |
c | |
c %-----------------------------% | |
c | Display computed residuals. | | |
c %-----------------------------% | |
c | |
call dmout(6, nconv, 3, d, maxncv, -6, | |
& 'Ritz values (Real,Imag) and relative residuals') | |
end if | |
c | |
c %-------------------------------------------% | |
c | Print additional convergence information. | | |
c %-------------------------------------------% | |
c | |
if ( info .eq. 1) then | |
print *, ' ' | |
print *, ' Maximum number of iterations reached.' | |
print *, ' ' | |
else if ( info .eq. 3) then | |
print *, ' ' | |
print *, ' No shifts could be applied during implicit', | |
& ' Arnoldi update, try increasing NCV.' | |
print *, ' ' | |
end if | |
c | |
print *, ' ' | |
print *, ' _NDRV1 ' | |
print *, ' ====== ' | |
print *, ' ' | |
print *, ' Size of the matrix is ', n | |
print *, ' The number of Ritz values requested is ', nev | |
print *, ' The number of Arnoldi vectors generated', | |
& ' (NCV) is ', ncv | |
print *, ' What portion of the spectrum: ', which | |
print *, ' The number of converged Ritz values is ', | |
& nconv | |
print *, ' The number of Implicit Arnoldi update', | |
& ' iterations taken is ', iparam(3) | |
print *, ' The number of OP*x is ', iparam(9) | |
print *, ' The convergence criterion is ', tol | |
print *, ' ' | |
c | |
end if | |
c | |
c %---------------------------% | |
c | Done with program dndrv1. | | |
c %---------------------------% | |
c | |
9000 continue | |
c | |
c====== DEALLOCATE DYNAMICALLY ALLOCATED MATRIX A ================================================== | |
deallocate(A) | |
c=================================================================================================== | |
end | |
c | |
c========================================================================== | |
c simple matrix*vector product Y=A*X using BLAS routine DGEMV | |
c Matrix A is fetched via a pointer in a common block (sorry, it would have been easir to just pass | |
c the matrix, but subroutine av needs this format, otherwise the whole program is messed up | |
subroutine av (N,X,Y) | |
implicit none | |
integer N | |
double precision X(N), Y(N), alpha, beta | |
double precision, pointer :: pA(:,:) | |
common /aptr/ pA | |
external dgemv | |
alpha = 1 | |
beta = 0 | |
call dgemv('N', N, N, alpha, pA, N, X, 1, beta, Y, 1) | |
return | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c\BeginDoc | |
c | |
c\Name: dneupd | |
c | |
c\Description: | |
c | |
c This subroutine returns the converged approximations to eigenvalues | |
c of A*z = lambda*B*z and (optionally): | |
c | |
c (1) The corresponding approximate eigenvectors; | |
c | |
c (2) An orthonormal basis for the associated approximate | |
c invariant subspace; | |
c | |
c (3) Both. | |
c | |
c There is negligible additional cost to obtain eigenvectors. An orthonormal | |
c basis is always computed. There is an additional storage cost of n*nev | |
c if both are requested (in this case a separate array Z must be supplied). | |
c | |
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z | |
c are derived from approximate eigenvalues and eigenvectors of | |
c of the linear operator OP prescribed by the MODE selection in the | |
c call to DNAUPD . DNAUPD must be called before this routine is called. | |
c These approximate eigenvalues and vectors are commonly called Ritz | |
c values and Ritz vectors respectively. They are referred to as such | |
c in the comments that follow. The computed orthonormal basis for the | |
c invariant subspace corresponding to these Ritz values is referred to as a | |
c Schur basis. | |
c | |
c See documentation in the header of the subroutine DNAUPD for | |
c definition of OP as well as other terms and the relation of computed | |
c Ritz values and Ritz vectors of OP with respect to the given problem | |
c A*z = lambda*B*z. For a brief description, see definitions of | |
c IPARAM(7), MODE and WHICH in the documentation of DNAUPD . | |
c | |
c\Usage: | |
c call dneupd | |
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI, WORKEV, BMAT, | |
c N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, WORKD, WORKL, | |
c LWORKL, INFO ) | |
c | |
c\Arguments: | |
c RVEC LOGICAL (INPUT) | |
c Specifies whether a basis for the invariant subspace corresponding | |
c to the converged Ritz value approximations for the eigenproblem | |
c A*z = lambda*B*z is computed. | |
c | |
c RVEC = .FALSE. Compute Ritz values only. | |
c | |
c RVEC = .TRUE. Compute the Ritz vectors or Schur vectors. | |
c See Remarks below. | |
c | |
c HOWMNY Character*1 (INPUT) | |
c Specifies the form of the basis for the invariant subspace | |
c corresponding to the converged Ritz values that is to be computed. | |
c | |
c = 'A': Compute NEV Ritz vectors; | |
c = 'P': Compute NEV Schur vectors; | |
c = 'S': compute some of the Ritz vectors, specified | |
c by the logical array SELECT. | |
c | |
c SELECT Logical array of dimension NCV. (INPUT) | |
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be | |
c computed. To select the Ritz vector corresponding to a | |
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE.. | |
c If HOWMNY = 'A' or 'P', SELECT is used as internal workspace. | |
c | |
c DR Double precision array of dimension NEV+1. (OUTPUT) | |
c If IPARAM(7) = 1,2 or 3 and SIGMAI=0.0 then on exit: DR contains | |
c the real part of the Ritz approximations to the eigenvalues of | |
c A*z = lambda*B*z. | |
c If IPARAM(7) = 3, 4 and SIGMAI is not equal to zero, then on exit: | |
c DR contains the real part of the Ritz values of OP computed by | |
c DNAUPD . A further computation must be performed by the user | |
c to transform the Ritz values computed for OP by DNAUPD to those | |
c of the original system A*z = lambda*B*z. See remark 3 below. | |
c | |
c DI Double precision array of dimension NEV+1. (OUTPUT) | |
c On exit, DI contains the imaginary part of the Ritz value | |
c approximations to the eigenvalues of A*z = lambda*B*z associated | |
c with DR. | |
c | |
c NOTE: When Ritz values are complex, they will come in complex | |
c conjugate pairs. If eigenvectors are requested, the | |
c corresponding Ritz vectors will also come in conjugate | |
c pairs and the real and imaginary parts of these are | |
c represented in two consecutive columns of the array Z | |
c (see below). | |
c | |
c Z Double precision N by NEV+1 array if RVEC = .TRUE. and HOWMNY = 'A'. (OUTPUT) | |
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of | |
c Z represent approximate eigenvectors (Ritz vectors) corresponding | |
c to the NCONV=IPARAM(5) Ritz values for eigensystem | |
c A*z = lambda*B*z. | |
c | |
c The complex Ritz vector associated with the Ritz value | |
c with positive imaginary part is stored in two consecutive | |
c columns. The first column holds the real part of the Ritz | |
c vector and the second column holds the imaginary part. The | |
c Ritz vector associated with the Ritz value with negative | |
c imaginary part is simply the complex conjugate of the Ritz vector | |
c associated with the positive imaginary part. | |
c | |
c If RVEC = .FALSE. or HOWMNY = 'P', then Z is not referenced. | |
c | |
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required, | |
c the array Z may be set equal to first NEV+1 columns of the Arnoldi | |
c basis array V computed by DNAUPD . In this case the Arnoldi basis | |
c will be destroyed and overwritten with the eigenvector basis. | |
c | |
c LDZ Integer. (INPUT) | |
c The leading dimension of the array Z. If Ritz vectors are | |
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1. | |
c | |
c SIGMAR Double precision (INPUT) | |
c If IPARAM(7) = 3 or 4, represents the real part of the shift. | |
c Not referenced if IPARAM(7) = 1 or 2. | |
c | |
c SIGMAI Double precision (INPUT) | |
c If IPARAM(7) = 3 or 4, represents the imaginary part of the shift. | |
c Not referenced if IPARAM(7) = 1 or 2. See remark 3 below. | |
c | |
c WORKEV Double precision work array of dimension 3*NCV. (WORKSPACE) | |
c | |
c **** The remaining arguments MUST be the same as for the **** | |
c **** call to DNAUPD that was just completed. **** | |
c | |
c NOTE: The remaining arguments | |
c | |
c BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, | |
c WORKD, WORKL, LWORKL, INFO | |
c | |
c must be passed directly to DNEUPD following the last call | |
c to DNAUPD . These arguments MUST NOT BE MODIFIED between | |
c the the last call to DNAUPD and the call to DNEUPD . | |
c | |
c Three of these parameters (V, WORKL, INFO) are also output parameters: | |
c | |
c V Double precision N by NCV array. (INPUT/OUTPUT) | |
c | |
c Upon INPUT: the NCV columns of V contain the Arnoldi basis | |
c vectors for OP as constructed by DNAUPD . | |
c | |
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns | |
c contain approximate Schur vectors that span the | |
c desired invariant subspace. See Remark 2 below. | |
c | |
c NOTE: If the array Z has been set equal to first NEV+1 columns | |
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then the | |
c Arnoldi basis held by V has been overwritten by the desired | |
c Ritz vectors. If a separate array Z has been passed then | |
c the first NCONV=IPARAM(5) columns of V will contain approximate | |
c Schur vectors that span the desired invariant subspace. | |
c | |
c WORKL Double precision work array of length LWORKL. (OUTPUT/WORKSPACE) | |
c WORKL(1:ncv*ncv+3*ncv) contains information obtained in | |
c dnaupd . They are not changed by dneupd . | |
c WORKL(ncv*ncv+3*ncv+1:3*ncv*ncv+6*ncv) holds the | |
c real and imaginary part of the untransformed Ritz values, | |
c the upper quasi-triangular matrix for H, and the | |
c associated matrix representation of the invariant subspace for H. | |
c | |
c Note: IPNTR(9:13) contains the pointer into WORKL for addresses | |
c of the above information computed by dneupd . | |
c ------------------------------------------------------------- | |
c IPNTR(9): pointer to the real part of the NCV RITZ values of the | |
c original system. | |
c IPNTR(10): pointer to the imaginary part of the NCV RITZ values of | |
c the original system. | |
c IPNTR(11): pointer to the NCV corresponding error bounds. | |
c IPNTR(12): pointer to the NCV by NCV upper quasi-triangular | |
c Schur matrix for H. | |
c IPNTR(13): pointer to the NCV by NCV matrix of eigenvectors | |
c of the upper Hessenberg matrix H. Only referenced by | |
c dneupd if RVEC = .TRUE. See Remark 2 below. | |
c ------------------------------------------------------------- | |
c | |
c INFO Integer. (OUTPUT) | |
c Error flag on output. | |
c | |
c = 0: Normal exit. | |
c | |
c = 1: The Schur form computed by LAPACK routine dlahqr | |
c could not be reordered by LAPACK routine dtrsen . | |
c Re-enter subroutine dneupd with IPARAM(5)=NCV and | |
c increase the size of the arrays DR and DI to have | |
c dimension at least dimension NCV and allocate at least NCV | |
c columns for Z. NOTE: Not necessary if Z and V share | |
c the same space. Please notify the authors if this error | |
c occurs. | |
c | |
c = -1: N must be positive. | |
c = -2: NEV must be positive. | |
c = -3: NCV-NEV >= 2 and less than or equal to N. | |
c = -5: WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI' | |
c = -6: BMAT must be one of 'I' or 'G'. | |
c = -7: Length of private work WORKL array is not sufficient. | |
c = -8: Error return from calculation of a real Schur form. | |
c Informational error from LAPACK routine dlahqr . | |
c = -9: Error return from calculation of eigenvectors. | |
c Informational error from LAPACK routine dtrevc . | |
c = -10: IPARAM(7) must be 1,2,3,4. | |
c = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatible. | |
c = -12: HOWMNY = 'S' not yet implemented | |
c = -13: HOWMNY must be one of 'A' or 'P' if RVEC = .true. | |
c = -14: DNAUPD did not find any eigenvalues to sufficient | |
c accuracy. | |
c | |
c NEW: -15 now obsolete. Should be never returned! | |
c ( = -15: DNEUPD got a different count of the number of converged | |
c Ritz values than DNAUPD got. This indicates the user | |
c probably made an error in passing data from DNAUPD to | |
c DNEUPD or that the data was modified before entering | |
c DNEUPD ) | |
c | |
c\BeginLib | |
c | |
c\References: | |
c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in | |
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), | |
c pp 357-385. | |
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly | |
c Restarted Arnoldi Iteration", Rice University Technical Report | |
c TR95-13, Department of Computational and Applied Mathematics. | |
c 3. B.N. Parlett & Y. Saad, "Complex Shift and Invert Strategies for | |
c Real Matrices", Linear Algebra and its Applications, vol 88/89, | |
c pp 575-595, (1987). | |
c | |
c\Routines called: | |
c ivout ARPACK utility routine that prints integers. | |
c dmout ARPACK utility routine that prints matrices | |
c dvout ARPACK utility routine that prints vectors. | |
c dgeqr2 LAPACK routine that computes the QR factorization of | |
c a matrix. | |
c dlacpy LAPACK matrix copy routine. | |
c dlahqr LAPACK routine to compute the real Schur form of an | |
c upper Hessenberg matrix. | |
c dlamch LAPACK routine that determines machine constants. | |
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. | |
c dlaset LAPACK matrix initialization routine. | |
c dorm2r LAPACK routine that applies an orthogonal matrix in | |
c factored form. | |
c dtrevc LAPACK routine to compute the eigenvectors of a matrix | |
c in upper quasi-triangular form. | |
c dtrsen LAPACK routine that re-orders the Schur form. | |
c dtrmm Level 3 BLAS matrix times an upper triangular matrix. | |
c dger Level 2 BLAS rank one update to a matrix. | |
c dcopy Level 1 BLAS that copies one vector to another . | |
c ddot Level 1 BLAS that computes the scalar product of two vectors. | |
c dnrm2 Level 1 BLAS that computes the norm of a vector. | |
c dscal Level 1 BLAS that scales a vector. | |
c | |
c\Remarks | |
c | |
c 1. Currently only HOWMNY = 'A' and 'P' are implemented. | |
c | |
c Let trans(X) denote the transpose of X. | |
c | |
c 2. Schur vectors are an orthogonal representation for the basis of | |
c Ritz vectors. Thus, their numerical properties are often superior. | |
c If RVEC = .TRUE. then the relationship | |
c A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and | |
c trans(V(:,1:IPARAM(5))) * V(:,1:IPARAM(5)) = I are approximately | |
c satisfied. Here T is the leading submatrix of order IPARAM(5) of the | |
c real upper quasi-triangular matrix stored workl(ipntr(12)). That is, | |
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; | |
c each 2-by-2 diagonal block has its diagonal elements equal and its | |
c off-diagonal elements of opposite sign. Corresponding to each 2-by-2 | |
c diagonal block is a complex conjugate pair of Ritz values. The real | |
c Ritz values are stored on the diagonal of T. | |
c | |
c 3. If IPARAM(7) = 3 or 4 and SIGMAI is not equal zero, then the user must | |
c form the IPARAM(5) Rayleigh quotients in order to transform the Ritz | |
c values computed by DNAUPD for OP to those of A*z = lambda*B*z. | |
c Set RVEC = .true. and HOWMNY = 'A', and | |
c compute | |
c trans(Z(:,I)) * A * Z(:,I) if DI(I) = 0. | |
c If DI(I) is not equal to zero and DI(I+1) = - D(I), | |
c then the desired real and imaginary parts of the Ritz value are | |
c trans(Z(:,I)) * A * Z(:,I) + trans(Z(:,I+1)) * A * Z(:,I+1), | |
c trans(Z(:,I)) * A * Z(:,I+1) - trans(Z(:,I+1)) * A * Z(:,I), | |
c respectively. | |
c Another possibility is to set RVEC = .true. and HOWMNY = 'P' and | |
c compute trans(V(:,1:IPARAM(5))) * A * V(:,1:IPARAM(5)) and then an upper | |
c quasi-triangular matrix of order IPARAM(5) is computed. See remark | |
c 2 above. | |
c | |
c\Authors | |
c Danny Sorensen Phuong Vu | |
c Richard Lehoucq CRPC / Rice University | |
c Chao Yang Houston, Texas | |
c Dept. of Computational & | |
c Applied Mathematics | |
c Rice University | |
c Houston, Texas | |
c | |
c\SCCS Information: @(#) | |
c FILE: neupd.F SID: 2.7 DATE OF SID: 09/20/00 RELEASE: 2 | |
c | |
c\EndLib | |
c | |
c Modifications: Valentin Zauner (preserve the order of eigenvalues, due to | |
c some changes in the Lapack-3-dlahqr routine. (2013-10-14) | |
c----------------------------------------------------------------------- | |
subroutine dneupd (rvec , howmny, select, dr , di, | |
& z , ldz , sigmar, sigmai, workev, | |
& bmat , n , which , nev , tol, | |
& resid, ncv , v , ldv , iparam, | |
& ipntr, workd , workl , lworkl, info) | |
c | |
c %----------------------------------------------------% | |
c | Include files for debugging and timing information | | |
c %----------------------------------------------------% | |
c | |
include 'debug.h' | |
include 'stat.h' | |
c | |
c %------------------% | |
c | Scalar Arguments | | |
c %------------------% | |
c | |
character bmat, howmny, which*2 | |
logical rvec | |
integer info, ldz, ldv, lworkl, n, ncv, nev | |
Double precision | |
& sigmar, sigmai, tol | |
c | |
c %-----------------% | |
c | Array Arguments | | |
c %-----------------% | |
c | |
integer iparam(11), ipntr(14) | |
logical select(ncv) | |
Double precision | |
& dr(nev+1) , di(nev+1), resid(n) , | |
& v(ldv,ncv) , z(ldz,*) , workd(3*n), | |
& workl(lworkl), workev(3*ncv) | |
c | |
c %------------% | |
c | Parameters | | |
c %------------% | |
c | |
Double precision | |
& one, zero | |
parameter (one = 1.0D+0 , zero = 0.0D+0 ) | |
c | |
c %---------------% | |
c | Local Scalars | | |
c %---------------% | |
c | |
character type*6 | |
integer bounds, ierr , ih , ihbds , | |
& iheigr, iheigi, iconj , nconv , | |
& invsub, iuptri, iwev , iwork(1), | |
& j , k , ldh , ldq , | |
& mode , msglvl, outncv, ritzr , | |
& ritzi , wri , wrr , irr , | |
& iri , ibd , ishift, numcnv , | |
& np , jj , nconv2 | |
logical reord | |
Double precision | |
& conds , rnorm, sep , temp, | |
& vl(1,1), temp1, eps23 | |
c | |
c %----------------------% | |
c | External Subroutines | | |
c %----------------------% | |
c | |
external dcopy , dger , dgeqr2 , dlacpy , | |
& dlahqr , dlaset , dmout , dorm2r , | |
& dtrevc , dtrmm , dtrsen , dscal , | |
& dvout , ivout | |
c | |
c %--------------------% | |
c | External Functions | | |
c %--------------------% | |
c | |
Double precision | |
& dlapy2 , dnrm2 , dlamch , ddot | |
external dlapy2 , dnrm2 , dlamch , ddot | |
c | |
c %---------------------% | |
c | Intrinsic Functions | | |
c %---------------------% | |
c | |
intrinsic abs, min, sqrt | |
c | |
c %-----------------------% | |
c | Executable Statements | | |
c %-----------------------% | |
c | |
c %------------------------% | |
c | Set default parameters | | |
c %------------------------% | |
c | |
msglvl = mneupd | |
mode = iparam(7) | |
nconv = iparam(5) | |
info = 0 | |
c | |
c %---------------------------------% | |
c | Get machine dependent constant. | | |
c %---------------------------------% | |
c | |
eps23 = dlamch ('Epsilon-Machine') | |
eps23 = eps23**(2.0D+0 / 3.0D+0 ) | |
c | |
c %--------------% | |
c | Quick return | | |
c %--------------% | |
c | |
ierr = 0 | |
c | |
if (nconv .le. 0) then | |
ierr = -14 | |
else if (n .le. 0) then | |
ierr = -1 | |
else if (nev .le. 0) then | |
ierr = -2 | |
else if (ncv .le. nev+1 .or. ncv .gt. n) then | |
ierr = -3 | |
else if (which .ne. 'LM' .and. | |
& which .ne. 'SM' .and. | |
& which .ne. 'LR' .and. | |
& which .ne. 'SR' .and. | |
& which .ne. 'LI' .and. | |
& which .ne. 'SI') then | |
ierr = -5 | |
else if (bmat .ne. 'I' .and. bmat .ne. 'G') then | |
ierr = -6 | |
else if (lworkl .lt. 3*ncv**2 + 6*ncv) then | |
ierr = -7 | |
else if ( (howmny .ne. 'A' .and. | |
& howmny .ne. 'P' .and. | |
& howmny .ne. 'S') .and. rvec ) then | |
ierr = -13 | |
else if (howmny .eq. 'S' ) then | |
ierr = -12 | |
end if | |
c | |
if (mode .eq. 1 .or. mode .eq. 2) then | |
type = 'REGULR' | |
else if (mode .eq. 3 .and. sigmai .eq. zero) then | |
type = 'SHIFTI' | |
else if (mode .eq. 3 ) then | |
type = 'REALPT' | |
else if (mode .eq. 4 ) then | |
type = 'IMAGPT' | |
else | |
ierr = -10 | |
end if | |
if (mode .eq. 1 .and. bmat .eq. 'G') ierr = -11 | |
c | |
c %------------% | |
c | Error Exit | | |
c %------------% | |
c | |
if (ierr .ne. 0) then | |
info = ierr | |
go to 9000 | |
end if | |
c | |
c %--------------------------------------------------------% | |
c | Pointer into WORKL for address of H, RITZ, BOUNDS, Q | | |
c | etc... and the remaining workspace. | | |
c | Also update pointer to be used on output. | | |
c | Memory is laid out as follows: | | |
c | workl(1:ncv*ncv) := generated Hessenberg matrix | | |
c | workl(ncv*ncv+1:ncv*ncv+2*ncv) := real and imaginary | | |
c | parts of ritz values | | |
c | workl(ncv*ncv+2*ncv+1:ncv*ncv+3*ncv) := error bounds | | |
c %--------------------------------------------------------% | |
c | |
c %-----------------------------------------------------------% | |
c | The following is used and set by DNEUPD . | | |
c | workl(ncv*ncv+3*ncv+1:ncv*ncv+4*ncv) := The untransformed | | |
c | real part of the Ritz values. | | |
c | workl(ncv*ncv+4*ncv+1:ncv*ncv+5*ncv) := The untransformed | | |
c | imaginary part of the Ritz values. | | |
c | workl(ncv*ncv+5*ncv+1:ncv*ncv+6*ncv) := The untransformed | | |
c | error bounds of the Ritz values | | |
c | workl(ncv*ncv+6*ncv+1:2*ncv*ncv+6*ncv) := Holds the upper | | |
c | quasi-triangular matrix for H | | |
c | workl(2*ncv*ncv+6*ncv+1: 3*ncv*ncv+6*ncv) := Holds the | | |
c | associated matrix representation of the invariant | | |
c | subspace for H. | | |
c | GRAND total of NCV * ( 3 * NCV + 6 ) locations. | | |
c %-----------------------------------------------------------% | |
c | |
ih = ipntr(5) | |
ritzr = ipntr(6) | |
ritzi = ipntr(7) | |
bounds = ipntr(8) | |
ldh = ncv | |
ldq = ncv | |
iheigr = bounds + ldh | |
iheigi = iheigr + ldh | |
ihbds = iheigi + ldh | |
iuptri = ihbds + ldh | |
invsub = iuptri + ldh*ncv | |
ipntr(9) = iheigr | |
ipntr(10) = iheigi | |
ipntr(11) = ihbds | |
ipntr(12) = iuptri | |
ipntr(13) = invsub | |
wrr = 1 | |
wri = ncv + 1 | |
iwev = wri + ncv | |
c | |
c %-----------------------------------------% | |
c | irr points to the REAL part of the Ritz | | |
c | values computed by _neigh before | | |
c | exiting _naup2. | | |
c | iri points to the IMAGINARY part of the | | |
c | Ritz values computed by _neigh | | |
c | before exiting _naup2. | | |
c | ibd points to the Ritz estimates | | |
c | computed by _neigh before exiting | | |
c | _naup2. | | |
c %-----------------------------------------% | |
c | |
irr = ipntr(14)+ncv*ncv | |
iri = irr+ncv | |
ibd = iri+ncv | |
c | |
c %------------------------------------% | |
c | RNORM is B-norm of the RESID(1:N). | | |
c %------------------------------------% | |
c | |
rnorm = workl(ih+2) | |
workl(ih+2) = zero | |
c | |
if (msglvl .gt. 2) then | |
call dvout (logfil, ncv, workl(irr), ndigit, | |
& '_neupd: Real part of Ritz values passed in from _NAUPD.') | |
call dvout (logfil, ncv, workl(iri), ndigit, | |
& '_neupd: Imag part of Ritz values passed in from _NAUPD.') | |
call dvout (logfil, ncv, workl(ibd), ndigit, | |
& '_neupd: Ritz estimates passed in from _NAUPD.') | |
end if | |
c | |
if (rvec) then | |
c | |
c %---------------------------------------------------------------% | |
c | Call LAPACK routine dlahqr to compute the real Schur form | | |
c | of the upper Hessenberg matrix returned by DNAUPD . | | |
c | Make a copy of the upper Hessenberg matrix. | | |
c | Initialize the Schur vector matrix Q to the identity. | | |
c | NEW: | | |
c | DO THIS RIGHT AWAY AND SORT EIGENVALUES OBTAINED FROM dlahqr | | |
c %---------------------------------------------------------------% | |
c | |
call dcopy (ldh*ncv, workl(ih), 1, workl(iuptri), 1) | |
call dlaset ('A', ncv, ncv, | |
& zero , one, workl(invsub), | |
& ldq) | |
call dlahqr (.true., .true. , ncv, | |
& 1 , ncv , workl(iuptri), | |
& ldh , workl(iheigr), workl(iheigi), | |
& 1 , ncv , workl(invsub), | |
& ldq , ierr) | |
call dcopy (ncv , workl(invsub+ncv-1), ldq, | |
& workl(ihbds), 1) | |
c | |
if (ierr .ne. 0) then | |
info = -8 | |
go to 9000 | |
end if | |
c | |
if (msglvl .gt. 1) then | |
call dvout (logfil, ncv, workl(iheigr), ndigit, | |
& '_neupd: Real part of the eigenvalues of H') | |
call dvout (logfil, ncv, workl(iheigi), ndigit, | |
& '_neupd: Imaginary part of the Eigenvalues of H') | |
call dvout (logfil, ncv, workl(ihbds), ndigit, | |
& '_neupd: Last row of the Schur vector matrix') | |
if (msglvl .gt. 3) then | |
call dmout (logfil , ncv, ncv , | |
& workl(iuptri), ldh, ndigit, | |
& '_neupd: The upper quasi-triangular matrix ') | |
end if | |
end if | |
c | |
reord = .false. | |
c %-----------------------------------------------% | |
c | NEW: | | |
c | copy calculated ritz values in other arrays, | | |
c | which can be sorted, s.t. that this sorting | | |
c | information can then be used to reorder them. | | |
c %-----------------------------------------------% | |
call dcopy (ncv,workl(iheigr),1,workl(irr),1) | |
call dcopy (ncv,workl(iheigi),1,workl(iri),1) | |
c | |
c %---------------------------------------------------% | |
c | Use the temporary bounds array to store indices | | |
c | These will be used to mark the select array later | | |
c %---------------------------------------------------% | |
c | |
do 10 j = 1,ncv | |
workl(bounds+j-1) = j | |
select(j) = .false. | |
10 continue | |
c | |
c %-------------------------------------% | |
c | Select the wanted Ritz values. | | |
c | Sort the Ritz values so that the | | |
c | wanted ones appear at the tailing | | |
c | NEV positions of workl(irr) and | | |
c | workl(iri). Move the corresponding | | |
c | error estimates in workl(bound) | | |
c | accordingly. | | |
c %-------------------------------------% | |
c | |
np = ncv - nev | |
ishift = 0 | |
call dngets (ishift , which , nev , | |
& np , workl(irr), workl(iri), | |
& workl(bounds), workl , workl(np+1)) | |
c | |
if (msglvl .gt. 2) then | |
call dvout (logfil, ncv, workl(irr), ndigit, | |
& '_neupd: Real part of Ritz values after calling _NGETS.') | |
call dvout (logfil, ncv, workl(iri), ndigit, | |
& '_neupd: Imag part of Ritz values after calling _NGETS.') | |
call dvout (logfil, ncv, workl(bounds), ndigit, | |
& '_neupd: Ritz value indices after calling _NGETS.') | |
end if | |
c | |
c %-----------------------------------------------------% | |
c | Record indices of the converged wanted Ritz values | | |
c | Mark the select array for possible reordering | | |
c | | | |
c | NEW VERSION WITHOUT BOUNDS CHECKING!!! | | |
c %-----------------------------------------------------% | |
c | |
do j = 1,nconv | |
jj = workl(bounds + ncv - j) | |
select(jj) = .true. | |
if (jj .gt. nconv) reord = .true. | |
end do | |
c=========================================================================== | |
c=== dont perform tolerance test, it had never failed before and is not === | |
c=== possible now due to the lack of ordering in the ibd array === | |
c=========================================================================== | |
c numcnv = 0 | |
c do 11 j = 1,ncv | |
c temp1 = max(eps23, | |
c & dlapy2 ( workl(irr+ncv-j), workl(iri+ncv-j) )) | |
c jj = workl(bounds + ncv - j) | |
c if (numcnv .lt. nconv .and. | |
c & workl(ibd+jj-1) .le. tol*temp1) then | |
c select(jj) = .true. | |
c numcnv = numcnv + 1 | |
c if (jj .gt. nconv) reord = .true. | |
c endif | |
c 11 continue | |
c | |
c %-----------------------------------------------------------% | |
c | Check the count (numcnv) of converged Ritz values with | | |
c | the number (nconv) reported by dnaupd. If these two | | |
c | are different then there has probably been an error | | |
c | caused by incorrect passing of the dnaupd data. | | |
c %-----------------------------------------------------------% | |
c | |
c if (msglvl .gt. 2) then | |
c call ivout(logfil, 1, numcnv, ndigit, | |
c & '_neupd: Number of specified eigenvalues') | |
c call ivout(logfil, 1, nconv, ndigit, | |
c & '_neupd: Number of "converged" eigenvalues') | |
c end if | |
c | |
c if (numcnv .ne. nconv) then | |
c info = -15 | |
c go to 9000 | |
c end if | |
c========================================================================================================================================= | |
if (reord) then | |
c | |
c %-----------------------------------------------------% | |
c | Reorder the computed upper quasi-triangular matrix. | | |
c %-----------------------------------------------------% | |
c | |
call dtrsen ('None' , 'V' , | |
& select , ncv , | |
& workl(iuptri), ldh , | |
& workl(invsub), ldq , | |
& workl(iheigr), workl(iheigi), | |
& nconv2 , conds , | |
& sep , workl(ihbds) , | |
& ncv , iwork , | |
& 1 , ierr) | |
c | |
if (nconv2 .lt. nconv) then | |
nconv = nconv2 | |
end if | |
if (ierr .eq. 1) then | |
info = 1 | |
go to 9000 | |
end if | |
c | |
if (msglvl .gt. 2) then | |
call dvout (logfil, ncv, workl(iheigr), ndigit, | |
& '_neupd: Real part of the eigenvalues of H--reordered') | |
call dvout (logfil, ncv, workl(iheigi), ndigit, | |
& '_neupd: Imag part of the eigenvalues of H--reordered') | |
if (msglvl .gt. 3) then | |
call dmout (logfil , ncv, ncv , | |
& workl(iuptri), ldq, ndigit, | |
& '_neupd: Quasi-triangular matrix after re-ordering') | |
end if | |
end if | |
c | |
end if | |
c | |
c %---------------------------------------% | |
c | Copy the last row of the Schur vector | | |
c | into workl(ihbds). This will be used | | |
c | to compute the Ritz estimates of | | |
c | converged Ritz values. | | |
c %---------------------------------------% | |
c | |
call dcopy (ncv, workl(invsub+ncv-1), ldq, workl(ihbds), 1) | |
c | |
c %----------------------------------------------------% | |
c | Place the computed eigenvalues of H into DR and DI | | |
c | if a spectral transformation was not used. | | |
c %----------------------------------------------------% | |
c | |
if (type .eq. 'REGULR') then | |
call dcopy (nconv, workl(iheigr), 1, dr, 1) | |
call dcopy (nconv, workl(iheigi), 1, di, 1) | |
end if | |
c | |
c %----------------------------------------------------------% | |
c | Compute the QR factorization of the matrix representing | | |
c | the wanted invariant subspace located in the first NCONV | | |
c | columns of workl(invsub,ldq). | | |
c %----------------------------------------------------------% | |
c | |
call dgeqr2 (ncv, nconv , workl(invsub), | |
& ldq, workev, workev(ncv+1), | |
& ierr) | |
c | |
c %---------------------------------------------------------% | |
c | * Postmultiply V by Q using dorm2r . | | |
c | * Copy the first NCONV columns of VQ into Z. | | |
c | * Postmultiply Z by R. | | |
c | The N by NCONV matrix Z is now a matrix representation | | |
c | of the approximate invariant subspace associated with | | |
c | the Ritz values in workl(iheigr) and workl(iheigi) | | |
c | The first NCONV columns of V are now approximate Schur | | |
c | vectors associated with the real upper quasi-triangular | | |
c | matrix of order NCONV in workl(iuptri) | | |
c %---------------------------------------------------------% | |
c | |
call dorm2r ('Right', 'Notranspose', n , | |
& ncv , nconv , workl(invsub), | |
& ldq , workev , v , | |
& ldv , workd(n+1) , ierr) | |
call dlacpy ('All', n, nconv, v, ldv, z, ldz) | |
c | |
do 20 j=1, nconv | |
c | |
c %---------------------------------------------------% | |
c | Perform both a column and row scaling if the | | |
c | diagonal element of workl(invsub,ldq) is negative | | |
c | I'm lazy and don't take advantage of the upper | | |
c | quasi-triangular form of workl(iuptri,ldq) | | |
c | Note that since Q is orthogonal, R is a diagonal | | |
c | matrix consisting of plus or minus ones | | |
c %---------------------------------------------------% | |
c | |
if (workl(invsub+(j-1)*ldq+j-1) .lt. zero) then | |
call dscal (nconv, -one, workl(iuptri+j-1), ldq) | |
call dscal (nconv, -one, workl(iuptri+(j-1)*ldq), 1) | |
end if | |
c | |
20 continue | |
c | |
if (howmny .eq. 'A') then | |
c | |
c %--------------------------------------------% | |
c | Compute the NCONV wanted eigenvectors of T | | |
c | located in workl(iuptri,ldq). | | |
c %--------------------------------------------% | |
c | |
do 30 j=1, ncv | |
if (j .le. nconv) then | |
select(j) = .true. | |
else | |
select(j) = .false. | |
end if | |
30 continue | |
c | |
call dtrevc ('Right', 'Select' , select , | |
& ncv , workl(iuptri), ldq , | |
& vl , 1 , workl(invsub), | |
& ldq , ncv , outncv , | |
& workev , ierr) | |
c | |
if (ierr .ne. 0) then | |
info = -9 | |
go to 9000 | |
end if | |
c | |
c %------------------------------------------------% | |
c | Scale the returning eigenvectors so that their | | |
c | Euclidean norms are all one. LAPACK subroutine | | |
c | dtrevc returns each eigenvector normalized so | | |
c | that the element of largest magnitude has | | |
c | magnitude 1; | | |
c %------------------------------------------------% | |
c | |
iconj = 0 | |
do 40 j=1, nconv | |
c | |
if ( workl(iheigi+j-1) .eq. zero ) then | |
c | |
c %----------------------% | |
c | real eigenvalue case | | |
c %----------------------% | |
c | |
temp = dnrm2 ( ncv, workl(invsub+(j-1)*ldq), 1 ) | |
call dscal ( ncv, one / temp, | |
& workl(invsub+(j-1)*ldq), 1 ) | |
c | |
else | |
c | |
c %-------------------------------------------% | |
c | Complex conjugate pair case. Note that | | |
c | since the real and imaginary part of | | |
c | the eigenvector are stored in consecutive | | |
c | columns, we further normalize by the | | |
c | square root of two. | | |
c %-------------------------------------------% | |
c | |
if (iconj .eq. 0) then | |
temp = dlapy2 (dnrm2 (ncv, | |
& workl(invsub+(j-1)*ldq), | |
& 1), | |
& dnrm2 (ncv, | |
& workl(invsub+j*ldq), | |
& 1)) | |
call dscal (ncv, one/temp, | |
& workl(invsub+(j-1)*ldq), 1 ) | |
call dscal (ncv, one/temp, | |
& workl(invsub+j*ldq), 1 ) | |
iconj = 1 | |
else | |
iconj = 0 | |
end if | |
c | |
end if | |
c | |
40 continue | |
c | |
call dgemv ('T', ncv, nconv, one, workl(invsub), | |
& ldq, workl(ihbds), 1, zero, workev, 1) | |
c | |
iconj = 0 | |
do 45 j=1, nconv | |
if (workl(iheigi+j-1) .ne. zero) then | |
c | |
c %-------------------------------------------% | |
c | Complex conjugate pair case. Note that | | |
c | since the real and imaginary part of | | |
c | the eigenvector are stored in consecutive | | |
c %-------------------------------------------% | |
c | |
if (iconj .eq. 0) then | |
workev(j) = dlapy2 (workev(j), workev(j+1)) | |
workev(j+1) = workev(j) | |
iconj = 1 | |
else | |
iconj = 0 | |
end if | |
end if | |
45 continue | |
c | |
if (msglvl .gt. 2) then | |
call dcopy (ncv, workl(invsub+ncv-1), ldq, | |
& workl(ihbds), 1) | |
call dvout (logfil, ncv, workl(ihbds), ndigit, | |
& '_neupd: Last row of the eigenvector matrix for T') | |
if (msglvl .gt. 3) then | |
call dmout (logfil, ncv, ncv, workl(invsub), ldq, | |
& ndigit, '_neupd: The eigenvector matrix for T') | |
end if | |
end if | |
c | |
c %---------------------------------------% | |
c | Copy Ritz estimates into workl(ihbds) | | |
c %---------------------------------------% | |
c | |
call dcopy (nconv, workev, 1, workl(ihbds), 1) | |
c | |
c %---------------------------------------------------------% | |
c | Compute the QR factorization of the eigenvector matrix | | |
c | associated with leading portion of T in the first NCONV | | |
c | columns of workl(invsub,ldq). | | |
c %---------------------------------------------------------% | |
c | |
call dgeqr2 (ncv, nconv , workl(invsub), | |
& ldq, workev, workev(ncv+1), | |
& ierr) | |
c | |
c %----------------------------------------------% | |
c | * Postmultiply Z by Q. | | |
c | * Postmultiply Z by R. | | |
c | The N by NCONV matrix Z is now contains the | | |
c | Ritz vectors associated with the Ritz values | | |
c | in workl(iheigr) and workl(iheigi). | | |
c %----------------------------------------------% | |
c | |
call dorm2r ('Right', 'Notranspose', n , | |
& ncv , nconv , workl(invsub), | |
& ldq , workev , z , | |
& ldz , workd(n+1) , ierr) | |
c | |
call dtrmm ('Right' , 'Upper' , 'No transpose', | |
& 'Non-unit', n , nconv , | |
& one , workl(invsub), ldq , | |
& z , ldz) | |
c | |
end if | |
c | |
else | |
c | |
c %------------------------------------------------------% | |
c | An approximate invariant subspace is not needed. | | |
c | Place the Ritz values computed DNAUPD into DR and DI | | |
c %------------------------------------------------------% | |
c | |
call dcopy (nconv, workl(ritzr), 1, dr, 1) | |
call dcopy (nconv, workl(ritzi), 1, di, 1) | |
call dcopy (nconv, workl(ritzr), 1, workl(iheigr), 1) | |
call dcopy (nconv, workl(ritzi), 1, workl(iheigi), 1) | |
call dcopy (nconv, workl(bounds), 1, workl(ihbds), 1) | |
end if | |
c | |
c %------------------------------------------------% | |
c | Transform the Ritz values and possibly vectors | | |
c | and corresponding error bounds of OP to those | | |
c | of A*x = lambda*B*x. | | |
c %------------------------------------------------% | |
c | |
if (type .eq. 'REGULR') then | |
c | |
if (rvec) | |
& call dscal (ncv, rnorm, workl(ihbds), 1) | |
c | |
else | |
c | |
c %---------------------------------------% | |
c | A spectral transformation was used. | | |
c | * Determine the Ritz estimates of the | | |
c | Ritz values in the original system. | | |
c %---------------------------------------% | |
c | |
if (type .eq. 'SHIFTI') then | |
c | |
if (rvec) | |
& call dscal (ncv, rnorm, workl(ihbds), 1) | |
c | |
do 50 k=1, ncv | |
temp = dlapy2 ( workl(iheigr+k-1), | |
& workl(iheigi+k-1) ) | |
workl(ihbds+k-1) = abs( workl(ihbds+k-1) ) | |
& / temp / temp | |
50 continue | |
c | |
else if (type .eq. 'REALPT') then | |
c | |
do 60 k=1, ncv | |
60 continue | |
c | |
else if (type .eq. 'IMAGPT') then | |
c | |
do 70 k=1, ncv | |
70 continue | |
c | |
end if | |
c | |
c %-----------------------------------------------------------% | |
c | * Transform the Ritz values back to the original system. | | |
c | For TYPE = 'SHIFTI' the transformation is | | |
c | lambda = 1/theta + sigma | | |
c | For TYPE = 'REALPT' or 'IMAGPT' the user must from | | |
c | Rayleigh quotients or a projection. See remark 3 above.| | |
c | NOTES: | | |
c | *The Ritz vectors are not affected by the transformation. | | |
c %-----------------------------------------------------------% | |
c | |
if (type .eq. 'SHIFTI') then | |
c | |
do 80 k=1, ncv | |
temp = dlapy2 ( workl(iheigr+k-1), | |
& workl(iheigi+k-1) ) | |
workl(iheigr+k-1) = workl(iheigr+k-1)/temp/temp | |
& + sigmar | |
workl(iheigi+k-1) = -workl(iheigi+k-1)/temp/temp | |
& + sigmai | |
80 continue | |
c | |
call dcopy (nconv, workl(iheigr), 1, dr, 1) | |
call dcopy (nconv, workl(iheigi), 1, di, 1) | |
c | |
else if (type .eq. 'REALPT' .or. type .eq. 'IMAGPT') then | |
c | |
call dcopy (nconv, workl(iheigr), 1, dr, 1) | |
call dcopy (nconv, workl(iheigi), 1, di, 1) | |
c | |
end if | |
c | |
end if | |
c | |
if (type .eq. 'SHIFTI' .and. msglvl .gt. 1) then | |
call dvout (logfil, nconv, dr, ndigit, | |
& '_neupd: Untransformed real part of the Ritz valuess.') | |
call dvout (logfil, nconv, di, ndigit, | |
& '_neupd: Untransformed imag part of the Ritz valuess.') | |
call dvout (logfil, nconv, workl(ihbds), ndigit, | |
& '_neupd: Ritz estimates of untransformed Ritz values.') | |
else if (type .eq. 'REGULR' .and. msglvl .gt. 1) then | |
call dvout (logfil, nconv, dr, ndigit, | |
& '_neupd: Real parts of converged Ritz values.') | |
call dvout (logfil, nconv, di, ndigit, | |
& '_neupd: Imag parts of converged Ritz values.') | |
call dvout (logfil, nconv, workl(ihbds), ndigit, | |
& '_neupd: Associated Ritz estimates.') | |
end if | |
c | |
c %-------------------------------------------------% | |
c | Eigenvector Purification step. Formally perform | | |
c | one of inverse subspace iteration. Only used | | |
c | for MODE = 2. | | |
c %-------------------------------------------------% | |
c | |
if (rvec .and. howmny .eq. 'A' .and. type .eq. 'SHIFTI') then | |
c | |
c %------------------------------------------------% | |
c | Purify the computed Ritz vectors by adding a | | |
c | little bit of the residual vector: | | |
c | T | | |
c | resid(:)*( e s ) / theta | | |
c | NCV | | |
c | where H s = s theta. Remember that when theta | | |
c | has nonzero imaginary part, the corresponding | | |
c | Ritz vector is stored across two columns of Z. | | |
c %------------------------------------------------% | |
c | |
iconj = 0 | |
do 110 j=1, nconv | |
if (workl(iheigi+j-1) .eq. zero) then | |
workev(j) = workl(invsub+(j-1)*ldq+ncv-1) / | |
& workl(iheigr+j-1) | |
else if (iconj .eq. 0) then | |
temp = dlapy2 ( workl(iheigr+j-1), workl(iheigi+j-1) ) | |
workev(j) = ( workl(invsub+(j-1)*ldq+ncv-1) * | |
& workl(iheigr+j-1) + | |
& workl(invsub+j*ldq+ncv-1) * | |
& workl(iheigi+j-1) ) / temp / temp | |
workev(j+1) = ( workl(invsub+j*ldq+ncv-1) * | |
& workl(iheigr+j-1) - | |
& workl(invsub+(j-1)*ldq+ncv-1) * | |
& workl(iheigi+j-1) ) / temp / temp | |
iconj = 1 | |
else | |
iconj = 0 | |
end if | |
110 continue | |
c | |
c %---------------------------------------% | |
c | Perform a rank one update to Z and | | |
c | purify all the Ritz vectors together. | | |
c %---------------------------------------% | |
c | |
call dger (n, nconv, one, resid, 1, workev, 1, z, ldz) | |
c | |
end if | |
c | |
9000 continue | |
c | |
return | |
c | |
c %---------------% | |
c | End of DNEUPD | | |
c %---------------% | |
c | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_neupd: Real part of Ritz values passed in from _NAUPD. | |
------------------------------------------------------- | |
1 - 10: 1.933D+01 1.494D+01 1.494D+01 1.494D+01 1.494D+01 1.933D+01 1.811D+01 1.516D+01 1.516D+01 1.811D+01 | |
11 - 20: -1.902D+01 -1.509D+01 -1.509D+01 1.108D+01 1.108D+01 -3.662D+00 -3.662D+00 3.842D+00 3.842D+00 -9.685D+00 | |
_neupd: Imag part of Ritz values passed in from _NAUPD. | |
------------------------------------------------------- | |
1 - 10: 0.000D+00 1.126D+01 -1.126D+01 1.126D+01 -1.126D+01 0.000D+00 0.000D+00 1.928D+00 -1.928D+00 0.000D+00 | |
11 - 20: 0.000D+00 1.121D+01 -1.121D+01 1.053D+01 -1.053D+01 1.481D+01 -1.481D+01 9.494D+00 -9.494D+00 0.000D+00 | |
_neupd: Ritz estimates passed in from _NAUPD. | |
--------------------------------------------- | |
1 - 10: 2.811D-20 3.633D-19 3.633D-19 7.264D-05 7.264D-05 2.758D-07 1.154D-14 2.858D-09 2.858D-09 3.479D-03 | |
11 - 20: 1.912D+00 6.139D+00 6.139D+00 2.550D+00 2.550D+00 6.603D+00 6.603D+00 1.082D+01 1.082D+01 1.379D+01 | |
_neupd: Real part of Ritz values after calling _NGETS. | |
------------------------------------------------------ | |
1 - 10: -1.902D+01 -1.509D+01 -1.509D+01 -9.685D+00 -3.662D+00 -3.662D+00 3.842D+00 3.842D+00 1.108D+01 1.108D+01 | |
11 - 20: 1.494D+01 1.494D+01 1.494D+01 1.494D+01 1.516D+01 1.516D+01 1.811D+01 1.811D+01 1.933D+01 1.933D+01 | |
_neupd: Imag part of Ritz values after calling _NGETS. | |
------------------------------------------------------ | |
1 - 10: 0.000D+00 1.121D+01 -1.121D+01 0.000D+00 1.481D+01 -1.481D+01 -9.494D+00 9.494D+00 -1.053D+01 1.053D+01 | |
11 - 20: -1.126D+01 1.126D+01 1.126D+01 -1.126D+01 -1.928D+00 1.928D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 | |
_neupd: Ritz value indices after calling _NGETS. | |
------------------------------------------------ | |
1 - 10: 1.100D+01 1.200D+01 1.300D+01 2.000D+01 1.600D+01 1.700D+01 1.900D+01 1.800D+01 1.500D+01 1.400D+01 | |
11 - 20: 3.000D+00 2.000D+00 4.000D+00 5.000D+00 9.000D+00 8.000D+00 1.000D+01 7.000D+00 6.000D+00 1.000D+00 | |
_neupd: Number of specified eigenvalues | |
--------------------------------------- | |
1 - 1: 1 | |
_neupd: Number of "converged" eigenvalues | |
----------------------------------------- | |
1 - 1: 1 | |
_neupd: Real part of the eigenvalues of H ---> ORDERING OF THE EIGENVALUES IS DIFFERENT FROM THE _NAUPD RESULTS | |
----------------------------------------- | |
1 - 10: 1.494D+01 1.494D+01 1.494D+01 1.494D+01 1.516D+01 1.516D+01 1.933D+01 1.933D+01 1.811D+01 1.811D+01 | |
11 - 20: -1.902D+01 -1.509D+01 -1.509D+01 1.108D+01 1.108D+01 -3.662D+00 -3.662D+00 3.842D+00 3.842D+00 -9.685D+00 | |
_neupd: Imaginary part of the Eigenvalues of H | |
---------------------------------------------- | |
1 - 10: 1.126D+01 -1.126D+01 1.126D+01 -1.126D+01 1.928D+00 -1.928D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 | |
11 - 20: 0.000D+00 1.121D+01 -1.121D+01 1.053D+01 -1.053D+01 1.481D+01 -1.481D+01 9.494D+00 -9.494D+00 0.000D+00 | |
_neupd: Last row of the Schur vector matrix | |
------------------------------------------- | |
1 - 10: 3.170D-20 -1.275D-20 -1.613D-05 2.525D-06 -2.524D-06 3.943D-06 -6.373D-06 -9.235D-06 4.153D-06 5.218D-04 | |
11 - 20: 1.291D-01 5.726D-01 9.368D-02 7.640D-02 1.503D-01 -3.218D-01 -2.558D-02 -2.955D-01 5.850D-01 2.907D-01 | |
_neupd: Last row of the eigenvector matrix for T | |
------------------------------------------------ | |
1 - 10: 0.000D+00 0.000D+00 -1.613D-05 2.525D-06 -2.524D-06 3.943D-06 -6.373D-06 -9.235D-06 4.153D-06 5.218D-04 | |
11 - 20: 1.291D-01 5.726D-01 9.368D-02 7.640D-02 1.503D-01 -3.218D-01 -2.558D-02 -2.955D-01 5.850D-01 2.907D-01 | |
_neupd: Real parts of converged Ritz values. | |
-------------------------------------------- | |
1 - 1: 1.494D+01 | |
_neupd: Imag parts of converged Ritz values. | |
-------------------------------------------- | |
1 - 1: 1.126D+01 | |
_neupd: Associated Ritz estimates. | |
---------------------------------- | |
1 - 1: 1.419D+02 | |
Ritz values (Real,Imag) and relative residuals | |
---------------------------------------------- | |
Col 1 Col 2 Col 3 | |
Row 1: 1.49415D+01 1.12599D+01 8.98760D-01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Amat2.bin | |
_neupd: Real part of Ritz values passed in from _NAUPD. | |
------------------------------------------------------- | |
1 - 10: 1.933D+01 1.494D+01 1.494D+01 1.494D+01 1.494D+01 1.933D+01 1.811D+01 1.516D+01 1.516D+01 1.811D+01 | |
11 - 20: -1.902D+01 -1.509D+01 -1.509D+01 1.108D+01 1.108D+01 -3.662D+00 -3.662D+00 3.842D+00 3.842D+00 -9.685D+00 | |
_neupd: Imag part of Ritz values passed in from _NAUPD. | |
------------------------------------------------------- | |
1 - 10: 0.000D+00 1.126D+01 -1.126D+01 1.126D+01 -1.126D+01 0.000D+00 0.000D+00 1.928D+00 -1.928D+00 0.000D+00 | |
11 - 20: 0.000D+00 1.121D+01 -1.121D+01 1.053D+01 -1.053D+01 1.481D+01 -1.481D+01 9.494D+00 -9.494D+00 0.000D+00 | |
_neupd: Ritz estimates passed in from _NAUPD. | |
--------------------------------------------- | |
1 - 10: 2.811D-20 3.633D-19 3.633D-19 7.264D-05 7.264D-05 2.758D-07 1.154D-14 2.858D-09 2.858D-09 3.479D-03 | |
11 - 20: 1.912D+00 6.139D+00 6.139D+00 2.550D+00 2.550D+00 6.603D+00 6.603D+00 1.082D+01 1.082D+01 1.379D+01 | |
_neupd: Real part of Ritz values after calling _NGETS. | |
------------------------------------------------------ | |
1 - 10: -1.902D+01 -1.509D+01 -1.509D+01 -9.685D+00 -3.662D+00 -3.662D+00 3.842D+00 3.842D+00 1.108D+01 1.108D+01 | |
11 - 20: 1.494D+01 1.494D+01 1.494D+01 1.494D+01 1.516D+01 1.516D+01 1.811D+01 1.811D+01 1.933D+01 1.933D+01 | |
_neupd: Imag part of Ritz values after calling _NGETS. | |
------------------------------------------------------ | |
1 - 10: 0.000D+00 1.121D+01 -1.121D+01 0.000D+00 1.481D+01 -1.481D+01 -9.494D+00 9.494D+00 -1.053D+01 1.053D+01 | |
11 - 20: -1.126D+01 1.126D+01 1.126D+01 -1.126D+01 -1.928D+00 1.928D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 | |
_neupd: Ritz value indices after calling _NGETS. | |
------------------------------------------------ | |
1 - 10: 1.100D+01 1.200D+01 1.300D+01 2.000D+01 1.600D+01 1.700D+01 1.900D+01 1.800D+01 1.500D+01 1.400D+01 | |
11 - 20: 3.000D+00 2.000D+00 4.000D+00 5.000D+00 9.000D+00 8.000D+00 1.000D+01 7.000D+00 6.000D+00 1.000D+00 | |
_neupd: Number of specified eigenvalues | |
--------------------------------------- | |
1 - 1: 1 | |
_neupd: Number of "converged" eigenvalues | |
----------------------------------------- | |
1 - 1: 1 | |
_neupd: Real part of the eigenvalues of H ---> ORDERING OF THE EIGENVALUES IS DIFFERENT FROM THE _NAUPD RESULTS | |
----------------------------------------- | |
1 - 10: 1.494D+01 1.494D+01 1.494D+01 1.494D+01 1.516D+01 1.516D+01 1.933D+01 1.933D+01 1.811D+01 1.811D+01 | |
11 - 20: -1.902D+01 -1.509D+01 -1.509D+01 1.108D+01 1.108D+01 -3.662D+00 -3.662D+00 3.842D+00 3.842D+00 -9.685D+00 | |
_neupd: Imaginary part of the Eigenvalues of H | |
---------------------------------------------- | |
1 - 10: 1.126D+01 -1.126D+01 1.126D+01 -1.126D+01 1.928D+00 -1.928D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 | |
11 - 20: 0.000D+00 1.121D+01 -1.121D+01 1.053D+01 -1.053D+01 1.481D+01 -1.481D+01 9.494D+00 -9.494D+00 0.000D+00 | |
_neupd: Last row of the Schur vector matrix | |
------------------------------------------- | |
1 - 10: 3.170D-20 -1.275D-20 -1.613D-05 2.525D-06 -2.524D-06 3.943D-06 -6.373D-06 -9.235D-06 4.153D-06 5.218D-04 | |
11 - 20: 1.291D-01 5.726D-01 9.368D-02 7.640D-02 1.503D-01 -3.218D-01 -2.558D-02 -2.955D-01 5.850D-01 2.907D-01 | |
_neupd: Last row of the eigenvector matrix for T | |
------------------------------------------------ | |
1 - 10: 0.000D+00 0.000D+00 -1.613D-05 2.525D-06 -2.524D-06 3.943D-06 -6.373D-06 -9.235D-06 4.153D-06 5.218D-04 | |
11 - 20: 1.291D-01 5.726D-01 9.368D-02 7.640D-02 1.503D-01 -3.218D-01 -2.558D-02 -2.955D-01 5.850D-01 2.907D-01 | |
_neupd: Real parts of converged Ritz values. | |
-------------------------------------------- | |
1 - 1: 1.494D+01 | |
_neupd: Imag parts of converged Ritz values. | |
-------------------------------------------- | |
1 - 1: 1.126D+01 | |
_neupd: Associated Ritz estimates. | |
---------------------------------- | |
1 - 1: 1.419D+02 | |
Ritz values (Real,Imag) and relative residuals | |
---------------------------------------------- | |
Col 1 Col 2 Col 3 | |
Row 1: 1.49415D+01 1.12599D+01 8.98760D-01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_neupd: Real part of Ritz values passed in from _NAUPD. | |
------------------------------------------------------- | |
1 - 10: 3.070D+01 3.070D+01 3.116D+01 2.841D+01 2.841D+01 2.654D+01 2.654D+01 3.024D+01 2.819D+01 2.062D+01 | |
11 - 20: 2.062D+01 -2.620D+01 -2.620D+01 1.890D+01 1.890D+01 -1.104D+01 -1.104D+01 3.126D+00 3.126D+00 9.259D+00 | |
_neupd: Imag part of Ritz values passed in from _NAUPD. | |
------------------------------------------------------- | |
1 - 10: 5.355D+00 -5.355D+00 0.000D+00 8.439D+00 -8.439D+00 1.320D+01 -1.320D+01 0.000D+00 0.000D+00 1.922D+01 | |
11 - 20: -1.922D+01 1.031D+01 -1.031D+01 1.819D+01 -1.819D+01 2.185D+01 -2.185D+01 2.225D+01 -2.225D+01 0.000D+00 | |
_neupd: Ritz estimates passed in from _NAUPD. | |
--------------------------------------------- | |
1 - 10: 1.888D-19 1.888D-19 2.090D-15 2.128D-13 2.128D-13 4.094D-12 4.094D-12 5.199D-09 9.747D-03 6.328D-04 | |
11 - 20: 6.328D-04 8.071D+00 8.071D+00 6.447D+00 6.447D+00 1.299D+01 1.299D+01 1.322D+01 1.322D+01 2.284D+01 | |
_neupd: Real part of Ritz values after calling _NGETS. | |
------------------------------------------------------ | |
1 - 10: -2.620D+01 -2.620D+01 -1.104D+01 -1.104D+01 3.126D+00 3.126D+00 9.259D+00 1.890D+01 1.890D+01 2.062D+01 | |
11 - 20: 2.062D+01 2.654D+01 2.654D+01 2.819D+01 2.841D+01 2.841D+01 3.024D+01 3.070D+01 3.070D+01 3.116D+01 | |
_neupd: Imag part of Ritz values after calling _NGETS. | |
------------------------------------------------------ | |
1 - 10: -1.031D+01 1.031D+01 2.185D+01 -2.185D+01 -2.225D+01 2.225D+01 0.000D+00 -1.819D+01 1.819D+01 -1.922D+01 | |
11 - 20: 1.922D+01 -1.320D+01 1.320D+01 0.000D+00 8.439D+00 -8.439D+00 0.000D+00 5.355D+00 -5.355D+00 0.000D+00 | |
_neupd: Ritz value indices after calling _NGETS. | |
------------------------------------------------ | |
1 - 10: 1.300D+01 1.200D+01 1.600D+01 1.700D+01 1.900D+01 1.800D+01 2.000D+01 1.500D+01 1.400D+01 1.100D+01 | |
11 - 20: 1.000D+01 7.000D+00 6.000D+00 9.000D+00 4.000D+00 5.000D+00 8.000D+00 1.000D+00 2.000D+00 3.000D+00 | |
_neupd: Number of specified eigenvalues | |
--------------------------------------- | |
1 - 1: 1 | |
_neupd: Number of "converged" eigenvalues | |
----------------------------------------- | |
1 - 1: 1 | |
_neupd: Real part of the eigenvalues of H ---> ORDERING OF THE EIGENVALUES IS DIFFERENT FROM THE _NAUPD RESULTS | |
----------------------------------------- | |
1 - 10: -2.620D+01 -2.620D+01 3.070D+01 3.070D+01 2.654D+01 2.654D+01 2.841D+01 2.841D+01 3.116D+01 3.024D+01 | |
11 - 20: -1.104D+01 -1.104D+01 2.819D+01 2.062D+01 2.062D+01 1.890D+01 1.890D+01 3.126D+00 3.126D+00 9.259D+00 | |
_neupd: Imaginary part of the Eigenvalues of H | |
---------------------------------------------- | |
1 - 10: 1.031D+01 -1.031D+01 5.355D+00 -5.355D+00 1.320D+01 -1.320D+01 8.439D+00 -8.439D+00 0.000D+00 0.000D+00 | |
11 - 20: 2.185D+01 -2.185D+01 0.000D+00 1.922D+01 -1.922D+01 1.819D+01 -1.819D+01 2.225D+01 -2.225D+01 0.000D+00 | |
_neupd: Last row of the Schur vector matrix | |
------------------------------------------- | |
1 - 10: 3.678D-01 2.374D-01 1.601D-03 4.330D-04 5.951D-03 -1.425D-02 1.691D-02 -1.024D-02 3.465D-03 8.448D-02 | |
11 - 20: 5.676D-01 7.042D-02 -3.675D-02 6.363D-02 -2.493D-02 -1.770D-01 8.444D-02 4.702D-01 -6.979D-03 4.560D-01 | |
_neupd: Real part of the eigenvalues of H--reordered | |
---------------------------------------------------- | |
1 - 10: 3.070D+01 3.070D+01 -2.620D+01 -2.620D+01 2.654D+01 2.654D+01 2.841D+01 2.841D+01 3.116D+01 3.024D+01 | |
11 - 20: -1.104D+01 -1.104D+01 2.819D+01 2.062D+01 2.062D+01 1.890D+01 1.890D+01 3.126D+00 3.126D+00 9.259D+00 | |
_neupd: Imag part of the eigenvalues of H--reordered | |
---------------------------------------------------- | |
1 - 10: 5.355D+00 -5.355D+00 1.031D+01 -1.031D+01 1.320D+01 -1.320D+01 8.439D+00 -8.439D+00 0.000D+00 0.000D+00 | |
11 - 20: 2.185D+01 -2.185D+01 0.000D+00 1.922D+01 -1.922D+01 1.819D+01 -1.819D+01 2.225D+01 -2.225D+01 0.000D+00 | |
_neupd: Last row of the eigenvector matrix for T | |
------------------------------------------------ | |
1 - 10: 0.000D+00 0.000D+00 -3.677D-01 -2.375D-01 5.951D-03 -1.425D-02 1.691D-02 -1.024D-02 3.465D-03 8.448D-02 | |
11 - 20: 5.676D-01 7.042D-02 -3.675D-02 6.363D-02 -2.493D-02 -1.770D-01 8.444D-02 4.702D-01 -6.979D-03 4.560D-01 | |
_neupd: Real parts of converged Ritz values. | |
-------------------------------------------- | |
1 - 1: 3.070D+01 | |
_neupd: Imag parts of converged Ritz values. | |
-------------------------------------------- | |
1 - 1: 5.355D+00 | |
_neupd: Associated Ritz estimates. | |
---------------------------------- | |
1 - 1: 3.208D+02 | |
Ritz values (Real,Imag) and relative residuals | |
---------------------------------------------- | |
Col 1 Col 2 Col 3 | |
Row 1: 3.06950D+01 5.35477D+00 2.49986D-01 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment