Conjugate Gradient technique
Barry Smith
bsmith at mcs.anl.gov
Thu May 14 16:03:41 CDT 2009
Please take a look at the manual pages for MATSHELL and
MatShellCreate(). You will need to create a matrix with
MatCreateShell() and then
supply your matrix vector operation with MatShellSetOperation() A
fortran example can be found at http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/ksp/ksp/examples/tutorials/ex14f.F.html
Barry
On May 14, 2009, at 3:58 PM, Barai, Pallab wrote:
> Hello,
>
> I am using PETSc to solve a set of linear equations "Sx=b".
>
> Here "b" is known and "x" is the trial solution.
>
> The complete (assembled) form of S is not known. That is why I am
> not able to use something like "KSPSolve".
>
> But given a trial solution "x", I can calculate "S*x" using a
> "MatVec" routine.
>
> Is it possible to use the Conjugate Gradient (CG) technique to find
> a solution in this case? In place of "S", I can give "S*x" as the
> input.
>
> It will be great if someone can show me some direction. If this
> thing has already been discussed before, the link to that thread
> will be sufficient.
>
> Thanking you.
>
> Pallab Barai
More information about the petsc-users
mailing list