<div dir="ltr">I used 'Matshell' and associated it with a custom-defined matrix-vector multiplication and used it to solve the eigenvalue problem (<span style="color:rgb(80,0,80)">(</span><b style="color:rgb(80,0,80)">((LU)^-H)*Q*</b><b style="color:rgb(80,0,80)">(LU)^-1)*</b><b style="color:rgb(80,0,80)">x = lmbda*x,</b><span style="color:rgb(80,0,80)"> where LU is the factor</span><b style="color:rgb(80,0,80)"> </b><span style="color:rgb(80,0,80)">of a </span><b style="color:rgb(80,0,80)">matrix </b><span style="color:rgb(80,0,80)"><b>B</b></span>). I compared the eigenvalue results with matlab, however in matlab, I computed the matrix <b>A<span style="color:rgb(80,0,80)">=(B^-H)*Q*B^-1</span></b><span style="color:rgb(80,0,80)"> </span>directly and used eig(A). Here are the results:<div><br><div>petsc('<b>eigVal.png'</b>): (method: krylovschur)</div><div>lmbd1 = 22.937184 </div><div>lmbd2 = -6.306099</div><div>lmbd3 = 2.904980<br></div><div>lmbd4 = 0.026435</div><div><br></div><div>Matlab:</div><div><div>lmbd1 = 0.0021</div><div>lmbd2 = 0.0840</div><div>lmbd3 = 3.9060<br></div><div>lmbd4 = 22.7579</div></div><div><br></div><div>It appears that the iterative procedure that I have adopted (in petsc) is accurate only for the largest eigenvalue. Is this correct? or is it due to some error in my code?</div><div><br></div><div>Also, I tried using shift-invert-strategy ('<b>code_snippet_sinvert.png'</b>) to see if I can get accurate non-largest eigenvalue, but it throws error ('<b>error.png'</b>) related to '<b>MatSolverType mumps does not support matrix type shell</b>', and it gives the same error message with petsc's native MATSOLVERSUPERLU. How to resolve this?</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 14, 2023 at 1:20 PM maitri ksh <<a href="mailto:maitri.ksh@gmail.com">maitri.ksh@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">got it, thanks Pierre & Jose.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 14, 2023 at 12:50 PM Jose E. Roman <<a href="mailto:jroman@dsic.upv.es" target="_blank">jroman@dsic.upv.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">See for instance ex3.c and ex9.c<br>
<a href="https://slepc.upv.es/documentation/current/src/eps/tutorials/index.html" rel="noreferrer" target="_blank">https://slepc.upv.es/documentation/current/src/eps/tutorials/index.html</a><br>
<br>
Jose<br>
<br>
<br>
> El 14 ago 2023, a las 10:45, Pierre Jolivet <<a href="mailto:pierre.jolivet@lip6.fr" target="_blank">pierre.jolivet@lip6.fr</a>> escribió:<br>
> <br>
> <br>
> <br>
>> On 14 Aug 2023, at 10:39 AM, maitri ksh <<a href="mailto:maitri.ksh@gmail.com" target="_blank">maitri.ksh@gmail.com</a>> wrote:<br>
>> <br>
>> <br>
>> Hi, <br>
>> I need to solve an eigenvalue problem Ax=lmbda*x, where A=(B^-H)*Q*B^-1 is a hermitian matrix, 'B^-H' refers to the hermitian of the inverse of the matrix B. Theoretically it would take around 1.8TB to explicitly compute the matrix B^-1 . A feasible way to solve this eigenvalue problem would be to use the LU factors of the B matrix instead. So the problem looks something like this: <br>
>> (((LU)^-H)*Q*(LU)^-1)*x = lmbda*x<br>
>> For a guess value of the (normalised) eigen-vector 'x', <br>
>> 1) one would require to solve two linear equations to get 'Ax', <br>
>> (LU)*y=x, solve for 'y',<br>
>> ((LU)^H)*z=Q*y, solve for 'z' <br>
>> then one can follow the conventional power-iteration procedure<br>
>> 2) update eigenvector: x= z/||z||<br>
>> 3) get eigenvalue using the Rayleigh quotient <br>
>> 4) go to step-1 and loop through with a conditional break.<br>
>> <br>
>> Is there any example in petsc that does not require explicit declaration of the matrix 'A' (Ax=lmbda*x) and instead takes a vector 'Ax' as input for an iterative algorithm (like the one above). I looked into some of the examples of eigenvalue problems ( it's highly possible that I might have overlooked, I am new to petsc) but I couldn't find a way to circumvent the explicit declaration of matrix A.<br>
> <br>
> You could use SLEPc with a MatShell, that’s the very purpose of this MatType.<br>
> <br>
> Thanks,<br>
> Pierre<br>
> <br>
>> Maitri<br>
<br>
</blockquote></div>
</blockquote></div>