[petsc-users] Calling EPSSolve() multiple times

Alejandro Cosimo alecosimo at gmail.com
Fri May 20 09:57:24 CDT 2016


Hi,

I would like to know if I'm using EPSSolve() correctly in the following
situation. I must solve a series of eigenvalue problems where the size of
the matrix and the EPS options remain the same, but the entries of the
matrix change for each problem. In pseudo-code, something like this:

Mat A;
/* create and set matrix */
EPSCreate(comm,&eps);
/* here set EPS options */
for (i=0;i<n;i++)  {
/* set entries of matrix A which vary for each index i of the for-loop */
EPSSetOperators(eps,A,NULL);
EPSSolve(eps);
}

My questions:
1* Is it correct to call at each iteration of the loop to EPSSetOperators()
before proceeding to solve the eigenvalue problem?
2* Would be wrong to call EPSSetOperators() before entering the loop and to
call to EPSReset() at every iteration instead of calling to
EPSSetOperators()?
3* A little different question, but related. Suppose a similar situation
where you have a KSP solver instead of an EPS solver. In this context, do
the answers to the previous questions apply similarly? That is, is it
correct to call at every iteration to KSPSetOperators() before  calling to
KSPSolve() or KSPSetUp()?

Thanks,
Alejandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160520/87616a10/attachment.html>


More information about the petsc-users mailing list