[petsc-dev] Computing inverse of a small matrix: MatLUFactor() usage
Shao-Ching Huang
huangsc at gmail.com
Wed Nov 21 16:41:53 CST 2012
I have used these in the past to invert small matrices:
src/mat/impls/baij/seq/dgefa*.c
dgefa3.c may be what you want.
On Wed, Nov 21, 2012 at 12:23 PM, Gautam Bisht <gbisht at lbl.gov> wrote:
> Jed,
>
> On Nov 21, 2012, at 12:09 PM, Jed Brown wrote:
>
> On Wed, Nov 21, 2012 at 9:03 PM, Gautam Bisht <gbisht at lbl.gov> wrote:
>>
>> I need to compute an inverse of M, a small matrix (3x3), and am coding in
>> Fortran 90. Following the suggestion under FAQ on the website, I'm trying to
>> use MatMatSolve to obtain the inverse of matrix. I did the following:
>>
>> - Created three sequential dense matrices: M, I, Minv
>> - Filled values in M and I using MatSetValues
>> - Tried factoring Matrix M before calling MatMatSolve(M,I,Minv,ierr)
>>
>> I'm not sure what arguments needs to be passed as arguments in
>> MatLUFactor() corresponding to IS row, IS col, and MatFactorInfo. I noticed
>> the following note on website that states "Developer Note: fortran interface
>> is not autogenerated as the f90 interface defintion cannot be generated
>> correctly [due to MatFactorInfo]".
>> Is there a Fortran90 example demonstrating the use of MatMatSolve()?
>
>
> For a 3x3 matrix, you should just use the explicit formula for the inverse.
> Going through the PETSc interface doesn't make sense at all.
>
>
> The 3x3 matrix is being generated using MatMult of 3xN and Nx3 matrices. I
> wanted to give MatMatSolve a try, but could not figure how to use it via
> Fortran. I will now code up the explicit formula.
>
>
>>
>>
>> Additionally, I have been trying to update my copy of petsc-dev, and am
>> getting timed out from the server.
>
>
> The server died so it has moved to https://bitbucket.org/petsc/petsc-dev.
>
>
>
> -Gautam.
More information about the petsc-dev
mailing list