[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] gsl and Mahalanobis distance (without LU decomposition an
From: |
Tomas Hudik |
Subject: |
Re: [Help-gsl] gsl and Mahalanobis distance (without LU decomposition and inversion) |
Date: |
Thu, 23 Aug 2007 17:15:33 +0200 |
On 8/23/07, Brian Gough <address@hidden> wrote:
> At Mon, 20 Aug 2007 18:00:44 +0200,
> Tomas Hudik wrote:
> > Equation for Mahalanobis distance is: M(x) = sqrt( (x-m)^T x C^(-1) x (x-m)
> > )
> > where x is an example (n dimensional vector), m is mean, C^(-1) is inverse
> > covariance matrix (also n-dimensional).
> >
> > I'd like to know, if it is possible to somehow avoid inverse matrix
> > computing
> > (functions : gsl_linalg_LU_decomp() and gsl_linalg_LU_invert() ).
> >
> > As we know the covariance matrix is symmetric and positive definite,
> > therefore
> > we can decompose it by gsl_linalg_cholesky_decomp (gsl_matrix * A).
> > Is there any possibility how would be possible to use
> > gsl_linalg_cholesky_solve?
> >
> > Or, is there any other faster way how to compute Mhalanobis distance?
> > (without inverse matrix by LU decomposition)
>
> If you compute the cholesky decomposition you only need to invert a
> triangular matrix, which can be done with blas dtrsv, to get the
> inverse.
>
> --
> Brian Gough
>
> Network Theory Ltd,c
> Publishing the GSL Manual - http://www.network-theory.co.uk/gsl/manual/
>
Thanks for your answer.
I found a manual for dtrsv routine:
http://www.mathkeisan.com/UsersGuide/man/dtrsv.html
But there stand that the routine is for solving equations: A*x = b or
A'*x = b.
Didn't you think some blas routine from:
http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/lpp/essl.html.en_US/html/essl157.html
These routines count inverse triangular matrix.
Tomas Hudik,
www.fi.muni.cz