[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Inverse of a matrix
From: |
James Bergstra |
Subject: |
Re: [Help-gsl] Inverse of a matrix |
Date: |
Sun, 30 Apr 2006 12:17:43 -0400 |
User-agent: |
Mutt/1.4.2.1i |
> Thanks for your comprehensive answer, you have given a good approach
> for programming, I am now trying using GSL to do MCMC simulation and
> calculation, I wonder if there is some "simple and intuitive" way in GSL
> for computing the inverse of a matrix without exam it is symmetric,
> positive-definite or singular(if it is , we need generalized inverse)
> it seems that many "ad hoc" solutions are there, thanx for your
> suggestion!
You're welcome!
One algorithm for inverting a matrix is similar to what I described. I'll give
it in terms of Cholesky factorization, but other factorization methods are
necessary for other matrices (see the GSL linalg manual, or the lapack manual,
especially for LU factorization).
1. gsl_linalg_cholesky_decomp(SIGMA)
2. identity -> M
3. for each row m of M, gsl_linalg_cholesky_svx(SIGMA, m)
At the end of this procedure M stores inv(sigma).
--
james bergstra
http://www-etud.iro.umontreal.ca/~bergstrj