[petsc-users] MatMult with factored matrix

Daniel L Crumly daniel.crumly at Colorado.EDU
Thu Jul 8 12:06:09 CDT 2010


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.

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.




More information about the petsc-users mailing list