[petsc-users] MatMult with factored matrix

Barry Smith bsmith at mcs.anl.gov
Thu Jul 8 13:19:35 CDT 2010


On Jul 8, 2010, at 10:18 AM, Daniel L Crumly wrote:

> Thank you for the  quick reply - I actually do want the action of the factored matrix (or preconditioner) on a vector.  Is there a recommended workaround?

   If A =approx L*U then applying the preconditioner involves triangular solves of L and U and use MatSolve() to do this. If you want to actually apply L*U we don't have code for this, as Matt mentioned. But note that right, left or split (symmetric) preconditioning do not need the application of L or U only the triangular solves.

   If you want to form the product L*U to see how "far" from A it is we don't have code for that, you could write a new routine that directly access the data structure and does the product for you, but since it is not needed for traditional linear solvers we don't provide such a thing.

   Barry

>  
> Thanks
>  
> Daniel "The Plaid Mentat" Crumly
> Daniel.Crumly at colorado.edu
> --------
> I give you the desert chameleon, whose ability to blend itself into the background tells you all you need to know about the roots of ecology and the foundations of a personal identity.
> --Book of Diatribes from the Hayt Chronicle
> ----Herbert, Frank. Children of Dune 28.
>  
> From: petsc-users-bounces at mcs.anl.gov [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Matthew Knepley
> Sent: Thursday, July 08, 2010 11:10 AM
> To: PETSc users list
> Subject: Re: [petsc-users] MatMult with factored matrix
>  
> On Thu, Jul 8, 2010 at 7:06 PM, Daniel L Crumly <daniel.crumly at colorado.edu> wrote:
> Hello all -
> 
> Is there a recommended way to multiply a factored matrix by a vector
> (effectively MatMult where the matrix is a factored matrix or
> preconditioner)?  Specifically, I would like to get take the ILU
> factorization of a matrix, then multiply a vector by this approximation.
>  
> Do you actually want the action, or the action of the inverse? We only provide
> the action of the inverse
>  
> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatSolve.html
>  
>     Matt
>  
> What I currently have is:
> 
>  ierr = PCGetType(pc, &pctype);CHKERRQ(ierr);
>  if (strcmp(pctype, PCILU) == 0 || strcmp(pctype, PCICC) == 0) {
>    ierr = PCFactorGetMatrix(pc, &M);CHKERRQ(ierr);
>    ierr = MatMult(M, x, Mx);CHKERRQ(ierr);
>  }
> 
> which throws the runtime error (I'm currently using PETSc 3.0.0-p8.):
> 
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Object is in wrong state!
> [0]PETSC ERROR: Not for factored matrix!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> 
> Any suggestions are greatly appreciated, thank you.
> 
> Daniel "The Plaid Mentat" Crumly
> Daniel.Crumly at colorado.edu
> --------
> I give you the desert chameleon, whose ability to blend itself into the
> background tells you all you need to know about the roots of ecology and the
> foundations of a personal identity.
> --Book of Diatribes from the Hayt Chronicle
> ----Herbert, Frank. Children of Dune 28.
> 
> 
> 
> 
> 
> -- 
> 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/20100708/2407833c/attachment-0001.htm>


More information about the petsc-users mailing list