See for instance ex3.c and ex9.c
https://slepc.upv.es/documentation/current/src/eps/tutorials/index.html

Jose


> El 14 ago 2023, a las 10:45, Pierre Jolivet <[email protected]> escribió:
> 
> 
> 
>> On 14 Aug 2023, at 10:39 AM, maitri ksh <[email protected]> wrote:
>> 
>> 
>> Hi, 
>> 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: 
>>                      (((LU)^-H)*Q*(LU)^-1)*x = lmbda*x
>> For a guess value of the (normalised) eigen-vector 'x', 
>> 1) one would require to solve two linear equations to get 'Ax', 
>>         (LU)*y=x,             solve for 'y',
>>        ((LU)^H)*z=Q*y,   solve for 'z' 
>>     then one can follow the conventional power-iteration procedure
>> 2) update eigenvector: x= z/||z||
>> 3) get eigenvalue using the Rayleigh quotient 
>> 4) go to step-1 and loop through with a conditional break.
>> 
>> 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.
> 
> You could use SLEPc with a MatShell, that’s the very purpose of this MatType.
> 
> Thanks,
> Pierre
> 
>> Maitri

Reply via email to