On Fri, 21 Sep 2007, Randall Mackie wrote:
> I have a collegue who is considering to use PETSc for programming > his problem. He would like to know if you can get the actual > inverse of a matrix, because this inverse is embedded in another > larger system that is then solved. Then you may have to - create a dense matrix Ainv - call MatLUFactorSymbolic() and MatLUFactorNumeric() to get A=LU - loop over matrix columns: MatSolve(LU,A(:,j),Ainv(:,j)); Note, if A is in row-compressed format, getting its columns is VERY inefficient. Creating A as a dense matrix and using Lapack or scalapack would give better result. > > I suppose that if you solve the system directly, say with SuperLU > or MUMPS, you could get the actual inverse? I looked briefly through > the manual and documentation, but it didn't jump out at me. You get matrix factors: A = LU. Then A*x = b is solved using MatSolve(): L*y = b and U*x = y. Again, sparse matrix A gives dense matrix inverse inv(A). For computational efficiency and stability, we try to avoid computing inv(A). Hong > > Any advice here? > > Thanks, Randy > > -- > Randall Mackie > GSY-USA, Inc. > PMB# 643 > 2261 Market St., > San Francisco, CA 94114-1600 > Tel (415) 469-8649 > Fax (415) 469-5044 > > California Registered Geophysicist > License No. GP 1034 > >
