<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hello,
<div class=""><br class="">
</div>
<div class="">I am new to SLEPc and Petsc, so I would appreciate any help I can get with my question. I have a large eigenvalue problem I am solving, based on the linearization of a nonlinear code. The eigenvalue problem takes the form</div>
<div class=""><br class="">
</div>
<div class="">A.x = lambda.B.x<br class="">
<div class=""><br class="webkit-block-placeholder">
</div>
<div class="">I can generate the matrix B explicitly, but I can only form products of A.x, and not A itself, so I use a shell matrix. I also have an iterative solver I could potentially use as a preconditioner. That is, I have an operator K^-1 where</div>
<div class=""><br class="">
</div>
<div class="">K^-1 \approx (A - sigma.B)^-1</div>
<div class=""><br class="">
</div>
<div class="">But again, I don’t have K^-1 explicitly, rather I can form products of K^-1 with a vector, so I would need to use a shell matrix.</div>
<div class=""><br class="">
</div>
<div class="">I have had success with the un-preconditioned case, but can’t figure out how to do the preconditioned case. Any suggestions would be greatly appreciated. I work with Fortran. A code snippet with the un-preconditioned set-up follows. </div>
<div class=""><br class="">
</div>
<div class="">Thanks in advance.</div>
<div class="">Kenneth Hall</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">===============================================================</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... initialize slepc</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>SlepcInitialize<span style="color: #000000" class="">(</span>PETSC_NULL_CHARACTER<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">) ;
</span><span style="color: #941100" class="">if</span><span style="color: #000000" class=""> (</span>ierr<span style="color: #000000" class=""> .</span><span style="color: #941100" class="">ne</span><span style="color: #000000" class="">. 0)
</span><span style="color: #941100" class="">then</span><span style="color: #000000" class=""> ;
</span><span style="color: #941100" class="">stop</span><span style="color: #000000" class="">
</span><span style="color: #ff2600" class="">'SlepcInitialize failed'</span><span style="color: #000000" class=""> ;
</span><span style="color: #941100" class="">end</span><span style="color: #000000" class="">
</span><span style="color: #941100" class="">if</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... get size and rank of MPI process</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
MPI_Comm_size</span>(<span style="color: #0433ff" class="">PETSC_COMM_WORLD</span>,<span style="color: #0433ff" class="">sz</span> ,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
MPI_Comm_rank</span>(<span style="color: #0433ff" class="">PETSC_COMM_WORLD</span>,<span style="color: #0433ff" class="">rank</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(255, 38, 0);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">if</span><span style="color: #000000" class=""> (</span><span style="color: #0433ff" class="">sz</span><span style="color: #000000" class=""> .</span><span style="color: #941100" class="">ne</span><span style="color: #000000" class="">.
1) </span><span style="color: #941100" class="">then</span><span style="color: #000000" class=""> ;
</span><span style="color: #0433ff" class="">SETERRA</span><span style="color: #000000" class="">(</span><span style="color: #0433ff" class="">PETSC_COMM_SELF</span><span style="color: #000000" class="">,1,</span>'This is a uniprocessor example only!'<span style="color: #000000" class="">);
</span><span style="color: #941100" class="">endif</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... get user options</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>PetscOptionsGetInt<span style="color: #000000" class=""> (</span>PETSC_NULL_OPTIONS<span style="color: #000000" class="">,</span>PETSC_NULL_CHARACTER<span style="color: #000000" class="">,</span><span style="color: #ff2600" class="">'-n'</span><span style="color: #000000" class="">
,</span>n<span style="color: #000000" class=""> ,</span>flg<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">) ;
</span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>PetscOptionsHasName<span style="color: #000000" class="">(</span>PETSC_NULL_OPTIONS<span style="color: #000000" class="">,</span>PETSC_NULL_CHARACTER<span style="color: #000000" class="">,</span><span style="color: #ff2600" class="">'-terse'</span><span style="color: #000000" class="">,</span>terse<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... write out option list</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">if</span> (<span style="color: #0433ff" class="">rank</span> .<span style="color: #941100" class="">eq</span>. 0 )
<span style="color: #941100" class="">then</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">write</span>(*,*) <span style="color: #ff2600" class="">
'n = '</span>,<span style="color: #0433ff" class="">n</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">end</span> <span style="color: #941100" class="">
if</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... Register the matrix-vector subroutine for the operator that defines the eigensystem, Ax=kBx</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>MatCreateShell<span style="color: #000000" class="">(</span>PETSC_COMM_WORLD<span style="color: #000000" class="">,</span>n<span style="color: #000000" class="">,</span>n<span style="color: #000000" class="">,</span>n<span style="color: #000000" class="">,</span>n<span style="color: #000000" class="">,</span>PETSC_NULL_INTEGER<span style="color: #000000" class="">,</span>A<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
<span style="color: rgb(0, 0, 0);" class=""> </span><span style="color: rgb(148, 17, 0);" class="">call</span><span style="color: rgb(0, 0, 0);" class="">
</span><span style="color: rgb(4, 51, 255);" class="">MatShellSetOperation</span><span style="color: rgb(0, 0, 0);" class="">(</span><span style="color: rgb(4, 51, 255);" class="">A</span><span style="color: rgb(0, 0, 0);" class="">,</span><span style="color: rgb(4, 51, 255);" class="">MATOP_MULT</span><span style="color: rgb(0, 0, 0);" class="">,</span><span style="color: rgb(4, 51, 255);" class="">my_matmul_A</span><span style="color: rgb(0, 0, 0);" class="">,</span><span style="color: rgb(4, 51, 255);" class="">ierr</span><span style="color: rgb(0, 0, 0);" class="">)
; </span><span style="color: rgb(4, 51, 255);" class="">CHKERRA</span><span style="color: rgb(0, 0, 0);" class="">(</span><span style="color: rgb(4, 51, 255);" class="">ierr</span><span style="color: rgb(0, 0, 0);" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... set up B matrix</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
MatCreate</span>(<span style="color: #0433ff" class="">PETSC_COMM_WORLD</span>,<span style="color: #0433ff" class="">B</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
MatSetSizes</span>(<span style="color: #0433ff" class="">B</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">ierr</span>)
; <span style="color: #0433ff" class="">
CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
MatSetFromOptions</span>(<span style="color: #0433ff" class="">B</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
MatSetUp</span>(<span style="color: #0433ff" class="">B</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>My_Matrix_B<span style="color: #000000" class="">(</span>B<span style="color: #000000" class="">,</span>n<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... set up eigenvectors</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecCreate</span>(<span style="color: #0433ff" class="">PETSC_COMM_WORLD</span>,<span style="color: #0433ff" class="">xr</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecSetSizes</span>(<span style="color: #0433ff" class="">xr</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">ierr</span>)
; <span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecSetFromOptions</span>(<span style="color: #0433ff" class="">xr</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecSetUp</span>(<span style="color: #0433ff" class="">xr</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecCreate</span>(<span style="color: #0433ff" class="">PETSC_COMM_WORLD</span>,<span style="color: #0433ff" class="">xi</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecSetSizes</span>(<span style="color: #0433ff" class="">xi</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">n</span>,<span style="color: #0433ff" class="">ierr</span>)
; <span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecSetFromOptions</span>(<span style="color: #0433ff" class="">xi</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
VecSetUp</span>(<span style="color: #0433ff" class="">xi</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... Create eigensolver context</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSCreate</span>(<span style="color: #0433ff" class="">PETSC_COMM_WORLD</span>,<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... Set operators. In this case, it is a generalized eigenvalue problem</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSSetOperators</span>(<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">A</span>,<span style="color: #0433ff" class="">B</span>,<span style="color: #0433ff" class="">ierr</span>)
; <span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSSetProblemType</span>(<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">EPS_GNHEP</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... set default options</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSSetType</span>(<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">EPSKRYLOVSCHUR</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... set default eigenvalues to find</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>EPSSetWhichEigenpairs<span style="color: #000000" class="">(</span>eps<span style="color: #000000" class="">,</span>EPS_LARGEST_REAL<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... number of requested eigenvalues</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>EPSSetDimensions<span style="color: #000000" class="">(</span>eps<span style="color: #000000" class="">,</span>nev<span style="color: #000000" class="">,</span>PETSC_DEFAULT_INTEGER<span style="color: #000000" class="">,</span>PETSC_DEFAULT_INTEGER<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... set stopping criteria</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSSetTolerances</span>(<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">tol</span>,<span style="color: #0433ff" class="">maxit</span>,<span style="color: #0433ff" class="">ierr</span>)
; <span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... set up monitors</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>PetscViewerAndFormatCreate<span style="color: #000000" class="">(</span>PETSC_VIEWER_STDOUT_WORLD<span style="color: #000000" class="">,</span>PETSC_VIEWER_DEFAULT<span style="color: #000000" class="">,</span>vf<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>EPSMonitorSet<span style="color: #000000" class="">(</span>eps<span style="color: #000000" class="">,</span>EPSMONITORFIRST<span style="color: #000000" class="">,</span>vf<span style="color: #000000" class="">,</span>PetscViewerAndFormatDestroy<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>SlepcConvMonitorCreate<span style="color: #000000" class="">(</span>PETSC_VIEWER_STDOUT_WORLD<span style="color: #000000" class="">,</span>PETSC_VIEWER_DEFAULT<span style="color: #000000" class="">,</span>ctx<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(4, 51, 255);" class="">
<span style="color: #000000" class=""> </span><span style="color: #941100" class="">call</span><span style="color: #000000" class="">
</span>EPSMonitorSet<span style="color: #000000" class="">(</span>eps<span style="color: #000000" class="">,</span>EPSMONITORCONVERGED<span style="color: #000000" class="">,</span>ctx<span style="color: #000000" class="">,</span>SlepcConvMonitorDestroy<span style="color: #000000" class="">,</span>ierr<span style="color: #000000" class="">)
; </span>CHKERRA<span style="color: #000000" class="">(</span>ierr<span style="color: #000000" class="">)</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... Set solver parameters at runtime</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSSetFromOptions</span>(<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 143, 0);" class="">
!.... Solve the eigensystem</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Monaco;" class="">
<span style="color: #941100" class="">call</span> <span style="color: #0433ff" class="">
EPSSolve</span>(<span style="color: #0433ff" class="">eps</span>,<span style="color: #0433ff" class="">ierr</span>) ;
<span style="color: #0433ff" class="">CHKERRA</span>(<span style="color: #0433ff" class="">ierr</span>)</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
</body>
</html>