On Thu, May 14, 2009 at 3:58 PM, Barai, Pallab <baraip at ornl.gov> 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. You can use CG if S is symmetric. If not, try GMRES. > > 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. You can wrap your function in a MatShell: http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatCreateShell.html Matt > > Thanking you. > > Pallab Barai > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090514/80769a23/attachment.htm>
