Hi Chris,
Thanks for finding that bug !
Your patch is a bit too "strong". I would cahnge the < 1.0 into == 0.0
Eddy
> X-Authentication-Warning: pcroot.cern.ch: majordomo set sender to
owner-roottalk@root.cern.ch using -f
> Date: Wed, 05 Feb 2003 12:15:11 -0500
> From: Chris Crawford <chris2@lns.mit.edu>
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830
> X-Accept-Language: en-us, en
> MIME-Version: 1.0
> To: roottalk@pcroot.cern.ch
> Subject: [ROOT] TMatrix::Invert() bug
> Content-Transfer-Encoding: 7bit
>
> Hello,
> TMatrix::Invert() fails on symmetric, matrixes with a zero in the
> diagonal (even nonsingular ones). Example: (v3.05/00)
>
> root [11] float x[]={0,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1}
> float x[]={0,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1}
> root [12] TMatrix n(4,4,x)
> TMatrix n(4,4,x)
> root [13] n->Determinant()
> n->Determinant()
> (const Double_t)3.00000000000000000e+00
> root [14] n->Invert()
> n->Invert()
> Fatal in <TMatrix::>: val != 0.0 violated at line 895 of
> `matrix/src/TMatrix.cxx'
> aborting
>
>
> Here is patch to fix the problem:
>
> --- TMatrix.cxx.~1.37.~ 2002-12-10 14:00:48.000000000 +0000
> +++ TMatrix.cxx 2003-02-05 16:57:59.000000000 +0000
> @@ -1159,6 +1159,9 @@
> TVector diag(fNrows);
> if (symmetric) {
> diag = TMatrixDiag(*this);
> + for (int idx=0; idx<diag.fNrows; idx++) {
> + if (diag.fElements[idx] < 1.0) diag.fElements[idx] = 1.0;
> + }
> this->NormByDiag(diag);
> }
>
>
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:09 MET