[petsc-users] Operator matrix as a Matrix-free matrix

Barry Smith bsmith at mcs.anl.gov
Tue Feb 8 07:38:59 CST 2011


On Feb 8, 2011, at 7:28 AM, Umut Tabak wrote:

> Dear all,
> 
> I would like to create an operator matrix like
> 
> (I - 0.5 C^{-1}(C+kD))
> 
> for linear iterative solvers, where k is a given scalar and C and D are matrices from a FE  discretization.
> 
> Moreover, the second part of the operator matrix can be constructed efficiently by using a matrix-vector product and a forward-backward substitution since I have the factorization of C which is a symmetric matrix.
> 
> I guess I should use matrix free operations and create the two matrices as shell matrices such as M1 (for I) and M2 (for the rest of above) and sum them, is this the most efficient way to do this?
> 

   I would make a single MATSHELL, inside it I would store the k, the matrix C and the matrix D, in addition I would store in it a KSP object where I have called KSPSetOperators() with the C matrix. Then the PCApply for the shell matrix could be .5*( I - k* kspsolve(C)*D)  if I have my math correct. No reason that I can see for having more than one shell matrix.

   Barry

> Best wishes,
> Umut
> 
> -- 
> - Hope is a good thing, maybe the best of things
>   and no good thing ever dies...
> The Shawshank Redemption, replique of Tim Robbins
> 



More information about the petsc-users mailing list