[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: |
Brian Gough |
Subject: |
Re: [Help-gsl] gsl and Mahalanobis distance (without LU decomposition and inversion) |
Date: |
Thu, 23 Aug 2007 14:06:51 +0100 |
User-agent: |
Wanderlust/2.14.0 (Africa) Emacs/22.1 Mule/5.0 (SAKAKI) |
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,
Publishing the GSL Manual - http://www.network-theory.co.uk/gsl/manual/