Re: [ROOT] Compute the determinant and invert a covariance matrix

From: Eddy Offermann (eddy@rentec.com)
Date: Mon Jul 14 2003 - 16:39:19 MEST


Hi Pierre,

> Hi,
> 
> 1) No it's a covariance matrix used in a multi-gaussian distribution. Some
>    of the terms are positive and some others are negative. The matrix is
>    symmetric with a dominant diagonal.

  So your density distribution of the joint normal distribution is of the form

  prob =  constant exp(-1/2 (x-a)^T B (x-a))

     where x is your n-component vector and C = Invert(B) is the covariance matrix.

  B (and therefore C) IS positive definite so that y^T B y >=0 for any y !!

> 
> 2) To inverse the matrix, I wanted to use TRSINV, but you're right, it's
>    only for positive matrices, so it will not work... I need another
>    function...
> 

  NO you can use TMatrix::InverPosdef()

Eddy

> Thank you!
> 
> Pierre-Luc Drouin 
> 
> On Sat, 12 Jul 2003, Eddy Offermann wrote:
> 
> > Hi Pierre,
> > 
> > I got lost in the flurry of questions and replies:
> > 
> > 1) Is your matrix not positive definite involving density prob. ??
> >    if so why ??
> > 2) Valeri points you to Cholesky decomposition routines which
> >    are no different than the TMatrixD::InvertPosDef() routine.
> >    I would suggest to make use of the TMatrix class function
> >    if you already have your data stored in it.
> > 
> > Eddy
> > 
> > > 
> > > Hi,
> > > 
> > > my matrix is not only positive...
> > > 
> > > Pierre-Luc Drouin
> > > 
> > > On Sat, 12 Jul 2003, Eddy Offermann wrote:
> > > 
> > > > Hi Pierre,
> > > > 
> > > > Your matrix is probably not only symmetric but also postive definite (x^T A x >= 0)
> > > > For this case the TMatrixD::InvertPosDef() is the best choice.
> > > > Determinant is calculated through Double_t TMatrixD::Determinant().
> > > > 
> > > > Eddy
> > > > 
> > > > > 
> > > > > Hello,
> > > > > 
> > > > > I've to compute the determinant and to invert a matrix in order to
> > > > > evaluate density probabilities in a multi-gaussian distribution. So the
> > > > > matrix is symmetric, and diagonal terms are 2-3 order of magnitudes bigger
> > > > > than off-diagnoal terms. I want to minimize the error of truncature on
> > > > > determinant and inverse matrix. What should I use instead of
> > > > > TMatrix::Invert ?
> > > > > 
> > > > > Thank you!
> > > > > 
> > > > > Pierre-Luc Drouin
> > > > > 
> > > > 
> > > 
> > 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET