[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
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_set(my_g,i,gradient[i]);
gsl_vector*Sol=gsl_vector_alloc(numLegs);
gsl_blas_dgemv(CblasNoTrans, alpha,my_hinv,my_g,0.0,Sol);
Thanks,
Student.
________________________________
From: Joakim Hove [mailto:address@hidden
Sent: Tue 8/23/2005 7:55 AM
To: sxs4885
Cc: address@hidden
Subject: Re: [Help-gsl] Matrix Inverse
"sxs4885" <address@hidden> writes:
> I am using gsl to find the inverse of the matrix. [....]
Well,
show us some code, then maybe someone can help you.
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