23 double _tol,
int _maxIter,
int _verb) :
30 maxIterEigenSolve(_maxIter),
47 double _tol,
int _maxIter,
int _verb) :
54 maxIterEigenSolve(_maxIter),
72 return ARPACKm1::reSolve(numEigen, Q, lambda, 0);
77 int ARPACKm1::reSolve(
int numEigen,
Epetra_MultiVector &Q,
double *lambda,
int startingEV) {
124 if (numEigen <= startingEV) {
128 int info = myVerify.inputArguments(numEigen, K, 0, 0, Q, minimumSpaceDimension(numEigen));
132 int myPid = MyComm.MyPID();
134 int localSize = Q.MyLength();
135 int NCV = Q.NumVectors();
138 if (NCV > Q.GlobalLength()) {
139 if (numEigen >= Q.GlobalLength()) {
141 cerr <<
" !! The number of requested eigenvalues must be smaller than the dimension";
142 cerr <<
" of the matrix !!\n";
146 NCV = Q.GlobalLength();
149 int localVerbose = verbose*(myPid == 0);
152 highMem = (highMem > currentSize()) ? highMem : currentSize();
157 int *wI =
new (nothrow)
int[lwI];
161 memRequested +=
sizeof(int)*lwI/(1024.0*1024.0);
164 int *ipntr = wI + 11;
165 int *select = wI + 22;
167 int lworkl = NCV*(NCV+8);
168 int lwD = lworkl + 4*localSize;
169 double *wD =
new (nothrow)
double[lwD];
174 memRequested +=
sizeof(double)*(4*localSize+lworkl)/(1024.0*1024.0);
176 double *pointer = wD;
178 double *workl = pointer;
179 pointer = pointer + lworkl;
181 double *resid = pointer;
182 pointer = pointer + localSize;
184 double *workd = pointer;
186 double *v = Q.Values();
188 highMem = (highMem > currentSize()) ? highMem : currentSize();
192 if (startingEV > 0) {
194 memset(resid, 0, localSize*
sizeof(
double));
195 for (
int jj = 0; jj < startingEV; ++jj)
196 for (
int ii = 0; ii < localSize; ++ii)
197 resid[ii] += v[ii + jj*localSize];
202 iparam[3-1] = maxIterEigenSolve;
213 double *vTmp =
new (nothrow)
double[localSize];
219 memRequested +=
sizeof(double)*localSize/(1024.0*1024.0);
221 highMem = (highMem > currentSize()) ? highMem : currentSize();
223 if (localVerbose > 0) {
225 cout <<
" *|* Problem: ";
226 cout <<
"K*Q = Q D ";
228 cout <<
" *|* Algorithm = ARPACK (mode 1)" << endl;
229 cout <<
" *|* Number of requested eigenvalues = " << numEigen << endl;
231 cout.setf(ios::scientific, ios::floatfield);
232 cout <<
" *|* Tolerance for convergence = " << tolEigenSolve << endl;
234 cout <<
" *|* User-defined starting vector (Combination of " << startingEV <<
" vectors)\n";
235 cout <<
"\n -- Start iterations -- \n";
242 timeOuterLoop -= MyWatch.WallTime();
245 highMem = (highMem > currentSize()) ? highMem : currentSize();
249 callFortran.PSAUPD(MPIComm->
Comm(), &ido,
'I', localSize, which, numEigen, tolEigenSolve,
250 resid, NCV, v, localSize, iparam, ipntr, workd, workl, lworkl, &info, localVerbose);
252 callFortran.SAUPD(&ido,
'I', localSize, which, numEigen, tolEigenSolve, resid, NCV, v,
253 localSize, iparam, ipntr, workd, workl, lworkl, &info, localVerbose);
255 callFortran.SAUPD(&ido,
'I', localSize, which, numEigen, tolEigenSolve, resid, NCV, v,
256 localSize, iparam, ipntr, workd, workl, lworkl, &info, localVerbose);
259 if ((ido == 1) || (ido == -1)) {
261 v1.ResetView(workd + ipntr[0] - 1);
262 v2.ResetView(workd + ipntr[1] - 1);
263 timeStifOp -= MyWatch.WallTime();
265 timeStifOp += MyWatch.WallTime();
271 timeOuterLoop += MyWatch.WallTime();
272 highMem = (highMem > currentSize()) ? highMem : currentSize();
277 cerr <<
" Error with DSAUPD, info = " << info << endl;
284 timePostProce -= MyWatch.WallTime();
287 callFortran.PSEUPD(MPIComm->
Comm(), 1,
'A', select, lambda, v, localSize, sigma,
'I',
288 localSize, which, numEigen, tolEigenSolve, resid, NCV, v, localSize, iparam, ipntr,
289 workd, workl, lworkl, &info);
291 callFortran.SEUPD(1,
'A', select, lambda, v, localSize, sigma,
'I', localSize, which,
292 numEigen, tolEigenSolve, resid, NCV, v, localSize, iparam, ipntr, workd, workl,
295 callFortran.SEUPD(1,
'A', select, lambda, v, localSize, sigma,
'I', localSize, which,
296 numEigen, tolEigenSolve, resid, NCV, v, localSize, iparam, ipntr, workd, workl,
299 timePostProce += MyWatch.WallTime();
300 highMem = (highMem > currentSize()) ? highMem : currentSize();
306 cerr <<
" Error with DSEUPD, info = " << info << endl;
314 outerIter = iparam[3-1];
315 knownEV = iparam[5-1];
316 orthoOp = iparam[11-1];
323 return (info == 0) ? knownEV : info;
328 void ARPACKm1::initializeCounters() {
344 void ARPACKm1::algorithmInfo()
const {
346 int myPid = MyComm.MyPID();
349 cout <<
" Algorithm: ARPACK (Mode 1)\n";
355 void ARPACKm1::memoryInfo()
const {
357 int myPid = MyComm.MyPID();
359 double maxHighMem = 0.0;
360 double tmp = highMem;
361 MyComm.MaxAll(&tmp, &maxHighMem, 1);
363 double maxMemRequested = 0.0;
365 MyComm.MaxAll(&tmp, &maxMemRequested, 1);
369 cout.setf(ios::fixed, ios::floatfield);
370 cout <<
" Memory requested per processor by the eigensolver = (EST) ";
372 cout << maxMemRequested <<
" MB " << endl;
374 cout <<
" High water mark in eigensolver = (EST) ";
376 cout << maxHighMem <<
" MB " << endl;
383 void ARPACKm1::operationInfo()
const {
385 int myPid = MyComm.MyPID();
388 cout <<
" --- Operations ---\n\n";
389 cout <<
" Total number of orthogonalizations = ";
391 cout << orthoOp << endl;
392 cout <<
" Total number of stiffness matrix operations = ";
394 cout << stifOp << endl;
396 cout <<
" Total number of outer iterations = ";
398 cout << outerIter << endl;
405 void ARPACKm1::timeInfo()
const {
407 int myPid = MyComm.MyPID();
410 cout <<
" --- Timings ---\n\n";
411 cout.setf(ios::fixed, ios::floatfield);
413 cout <<
" Total time for outer loop = ";
415 cout << timeOuterLoop <<
" s" << endl;
416 cout <<
" Time for stiffness matrix = ";
418 cout << timeStifOp <<
" s ";
420 cout << 100*timeStifOp/timeOuterLoop <<
" %\n";
422 cout <<
" Total time for post-processing = ";
424 cout << timePostProce <<
" s\n";