[petsc-users] Using a Matrix Shell with SLEPc

Jed Brown jed at jedbrown.org
Fri Nov 7 16:56:08 CST 2014


Miguel Arriaga <miguelarriagaecunha at gmail.com> writes:

> Hi there,
> I have a matrix shell where the Mult operation looks like this:
> y=1/2(K+K*) x
> with K=M^-1 A and K* its transpose.
>
> 1- For setting-up the operation MatMult, since I need to do a KSPSolve on
> M, should I set-up the KSP on the operation MATOP_CREATE and destroy it on
> MATOP_DESTROY and store it as a global variable?

Store it in the context.  That's why callbacks always have a context.
Global variables are terrible.

> 2- For "inverting" M, considering that M is symmetric, Should I (a) use LU,
> or should I (b) use an iterative procedure like CG with ILU, since M is
> symmetric positive definite? Is there a faster iterative method for a SPD
> matrix?

CG/Jacobi is usually fine for the mass matrix.

> 3- I want to use this matrix shell in SLEPc to compute the largest positive
> eigenvalue, which will be smaller in magnitude than the smallest negative
> real (possibly very close to zero). Since it is a matrix shell I assume
> that I can't really use Shift-and-invert without choosing an iterative
> procedure that only requires MatMult. 

Start with a simple shift (not shift-and-invert).

> What would be the best Method+Preconditioner for this case? Note that
> this is a Real Symmetric matrix (but not Positive definite). Should I
> set all of these as true?
>
> MATOP_IS_HERMITIAN
> MATOP_IS_STRUCTURALLY_SYMMETRIC
> MATOP_IS_SYMMETRIC
>
> Thank you,
> Miguel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141108/5c8b2c44/attachment.pgp>


More information about the petsc-users mailing list