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

From: Pierre-Luc Drouin (pldrouin@physics.carleton.ca)
Date: Mon Jul 14 2003 - 19:02:22 MEST


Hi,

With TMatrix class, is it possible to compute the product x^T B x without
having to copy the x elements in memory to generate x^T?

Thank you!

Pierre-Luc Drouin

On Mon, 14 Jul 2003, Eddy Offermann wrote:

> Hi Pierre,
> 
> For the moment use Double_t TMatrixD::Determinant() in a future release
> I will have InvertPosdef changed to InverPosdef(Double_t *determ_ptr = 0)
> so that if you supply a pointer to a Double_t the determinant is returned
> (like the Invert function)
> 
> Eddy
> 
> > Date: Mon, 14 Jul 2003 11:10:55 -0400 (EDT)
> > From: Pierre-Luc Drouin <pldrouin@physics.carleton.ca>
> > To: Eddy Offermann <eddy@rentec.com>
> > cc: roottalk@pcroot.cern.ch
> > Subject: Re: [ROOT] Compute the determinant and invert a covariance matrix
> > MIME-Version: 1.0
> > 
> > Hi,
> > 
> > So I'll use this function. To compute the determinant of this kind of
> > matrix, what should I use?
> > 
> > Thank you!
> > 
> > Pierre-Luc Drouin
> > 
> > On Mon, 14 Jul 2003, Eddy Offermann wrote:
> > 
> > > 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
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> 
> Eddy A.J.M. Offermann
> Renaissance Technologies Corp.
> Route 25A, East Setauket NY 11733
> e-mail: eddy@rentec.com
> http://www.rentec.com
> 



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