help-gsl
[Top][All Lists]

## RE: [Help-gsl] Matrix Inverse

 From: sxs4885 Subject: RE: [Help-gsl] Matrix Inverse Date: Tue, 23 Aug 2005 08:38:21 -0500

```Thank you for the reply. Below are few lines of code that I used for the
inverse calculation.

gsl_matrix*my_h= gsl_matrix_alloc(numLegs,numLegs);
gsl_matrix*my_hinv= gsl_matrix_alloc (numLegs, numLegs);

for(i=0;i<numLegs;i++)
for(j=0;j<numLegs;j++)
gsl_matrix_set(my_h, i,j,Hessian[i][j]);

gsl_permutation * p = gsl_permutation_alloc(numLegs);
int signum;
gsl_linalg_LU_decomp (my_h, p, &signum);
gsl_linalg_LU_invert (my_h, p, my_hinv);
gsl_permutation_free(p);
gsl_matrix_free(my_h);
double alpha=1.0;
gsl_vector *my_g = gsl_vector_alloc(numLegs);
for(i=0;i<numLegs;i++)
gsl_vector*Sol=gsl_vector_alloc(numLegs);
gsl_blas_dgemv(CblasNoTrans, alpha,my_hinv,my_g,0.0,Sol);

Thanks,
Student.

________________________________

Sent: Tue 8/23/2005 7:55 AM
To: sxs4885
Subject: Re: [Help-gsl] Matrix Inverse

> I am using gsl to find the inverse of the matrix. [....]

Well,

Regards

Joakim

--
Joakim Hove
hove AT ift uib no                 /
Tlf: +47 (55 5)8 27 13            /     Stabburveien 18
Fax: +47 (55 5)8 94 40           /      N-5231 Paradis
http://www.ift.uib.no/~hove/    /       55 91 28 18 / 92 68 57 04

```