diff --git a/matrix/inc/LinkDef.h b/matrix/inc/LinkDef.h index f30d6e55ebe5be07891ea83e839795a3b7d92c46..d37402638079f458c7d794592d339bf5aec14c78 100644 --- a/matrix/inc/LinkDef.h +++ b/matrix/inc/LinkDef.h @@ -1,4 +1,4 @@ -/* @(#)root/matrix:$Name: $:$Id: LinkDef.h,v 1.21 2005/12/22 08:41:31 brun Exp $ */ +/* @(#)root/matrix:$Name: $:$Id: LinkDef.h,v 1.22 2005/12/23 07:20:10 brun Exp $ */ /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * @@ -393,4 +393,9 @@ #pragma link C++ function ElementDiv ( TMatrixDSparse &,const TMatrixDSparse &); #pragma link C++ function AreCompatible(const TMatrixDSparse &,const TMatrixDSparse &,Int_t); +#pragma link C++ function NormalEqn (const TMatrixD &,const TVectorD & ); +#pragma link C++ function NormalEqn (const TMatrixD &,const TVectorD &,const TVectorD &); +#pragma link C++ function NormalEqn (const TMatrixD &,const TMatrixD & ); +#pragma link C++ function NormalEqn (const TMatrixD &,const TMatrixD &,const TVectorD &); + #endif diff --git a/matrix/inc/TDecompBase.h b/matrix/inc/TDecompBase.h index 6dce3f0c0946631fb93240a582d913173f5396ed..9d05c5a63650e23aa6ee15b2660e0217953c543c 100644 --- a/matrix/inc/TDecompBase.h +++ b/matrix/inc/TDecompBase.h @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TDecompBase.h,v 1.13 2004/10/16 18:09:16 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TDecompBase.h,v 1.14 2005/12/22 08:41:31 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Dec 2003 /************************************************************************* @@ -21,7 +21,7 @@ // // /////////////////////////////////////////////////////////////////////////// -//#include <limits> +#include <limits> #ifndef ROOT_TMatrixD #include "TMatrixD.h" diff --git a/matrix/inc/TMatrixTBase.h b/matrix/inc/TMatrixTBase.h index 349181c60cc0bc6d1a9fb22e7d0c0992655e3740..12fbc0b60169b378e9f0d80309e64f25835a3e0b 100644 --- a/matrix/inc/TMatrixTBase.h +++ b/matrix/inc/TMatrixTBase.h @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TMatrixTBase.h,v 1.2 2005/12/23 07:20:10 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TMatrixTBase.h,v 1.3 2006/01/05 08:26:14 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Nov 2003 /************************************************************************* @@ -65,7 +65,8 @@ // // //======================================================================// -#include <limits.h> +#include <limits> + #ifndef ROOT_TROOT #include "TROOT.h" #endif @@ -225,8 +226,8 @@ template<class Element> void Compare (const TMatrixTBase<Element> &m1,c // They print some detail info if the validation condition fails template<class Element> Bool_t VerifyMatrixValue (const TMatrixTBase<Element> &m,Element val, - Int_t verbose=1,Element maxDevAllow=DBL_EPSILON); + Int_t verbose=1,Element maxDevAllow=std::numeric_limits<Element>::epsilon()); template<class Element> Bool_t VerifyMatrixIdentity(const TMatrixTBase<Element> &m1,const TMatrixTBase<Element> &m2, - Int_t verbose=1,Element maxDevAllow=DBL_EPSILON); + Int_t verbose=1,Element maxDevAllow=std::numeric_limits<Element>::epsilon()); #endif diff --git a/matrix/inc/TVectorT.h b/matrix/inc/TVectorT.h index 89dd9a9cc3254f530a318aa61230cb623c0c83d2..80e9e369389245b41d457bff57530bc8eeea787a 100644 --- a/matrix/inc/TVectorT.h +++ b/matrix/inc/TVectorT.h @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TVectorT.h,v 1.1 2005/12/22 09:13:49 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TVectorT.h,v 1.2 2005/12/23 07:20:10 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Nov 2003 /************************************************************************* @@ -235,8 +235,8 @@ template<class Element1,class Element2> template<class Element> void Compare (const TVectorT <Element> &source1,const TVectorT <Element> &source2); template<class Element> Bool_t VerifyVectorValue (const TVectorT <Element> &m, Element val, Int_t verbose=1, - Element maxDevAllow=DBL_EPSILON); + Element maxDevAllow=std::numeric_limits<Element>::epsilon()); template<class Element> Bool_t VerifyVectorIdentity (const TVectorT <Element> &m1, const TVectorT <Element> &m2, Int_t verbose=1, - Element maxDevAllow=DBL_EPSILON); + Element maxDevAllow=std::numeric_limits<Element>::epsilon()); #endif diff --git a/matrix/src/TDecompBase.cxx b/matrix/src/TDecompBase.cxx index 03ab632eab2e14693c983ef30d8092fb2152d554..4d9ec66cb91901bc2402d3ae16f6a0386415af26 100644 --- a/matrix/src/TDecompBase.cxx +++ b/matrix/src/TDecompBase.cxx @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TDecompBase.cxx,v 1.16 2004/10/16 18:09:16 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TDecompBase.cxx,v 1.17 2005/12/23 16:58:12 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Dec 2003 /************************************************************************* @@ -118,8 +118,7 @@ ClassImp(TDecompBase) //______________________________________________________________________________ TDecompBase::TDecompBase() { -// fTol = std::numerical_limits<double>::epsilon(); - fTol = DBL_EPSILON; + fTol = std::numeric_limits<double>::epsilon(); fDet1 = 0; fDet2 = 0; fCondition = -1.0; diff --git a/matrix/src/TDecompSVD.cxx b/matrix/src/TDecompSVD.cxx index c60bd5fef80260758cd4c97d894a4dde61f81d38..8f0c08b95dd780ff618354c41641e47dbd2e0486 100644 --- a/matrix/src/TDecompSVD.cxx +++ b/matrix/src/TDecompSVD.cxx @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TDecompSVD.cxx,v 1.22 2005/02/15 16:17:09 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TDecompSVD.cxx,v 1.24 2005/12/23 16:58:12 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Dec 2003 /************************************************************************* @@ -296,12 +296,14 @@ Bool_t TDecompSVD::Diagonalize(TMatrixD &v,TMatrixD &u,TVectorD &sDiag,TVectorD bmx = TMath::Max(TMath::Abs(sDiag(i))+TMath::Abs(oDiag(i)),bmx); } + const Double_t eps = std::numeric_limits<double>::epsilon(); + const Int_t niterm = 10*nCol_v; for (Int_t k = nCol_v-1; k >= 0; k--) { loop: if (k != 0) { // since sDiag(k) == 0 perform Givens transform with result oDiag[k] = 0 - if (TMath::Abs(sDiag(k)) < DBL_EPSILON*bmx) + if (TMath::Abs(sDiag(k)) < eps*bmx) Diag_1(v,sDiag,oDiag,k); // find l (1 <= l <=k) so that either oDiag(l) = 0 or sDiag(l-1) = 0. @@ -317,11 +319,11 @@ Bool_t TDecompSVD::Diagonalize(TMatrixD &v,TMatrixD &u,TVectorD &sDiag,TVectorD elzero = 0; break; } - else if (TMath::Abs(oDiag(l)) < DBL_EPSILON*bmx) { + else if (TMath::Abs(oDiag(l)) < eps*bmx) { elzero = 1; break; } - else if (TMath::Abs(sDiag(l-1)) < DBL_EPSILON*bmx) + else if (TMath::Abs(sDiag(l-1)) < eps*bmx) elzero = 0; } if (l > 0 && !elzero) diff --git a/matrix/src/TMatrixT.cxx b/matrix/src/TMatrixT.cxx index ce5df34adc9e1614ece12faed969e0b5ae93a1e1..557a4990e6346dc28710ddb1a61cc028d6a52cdf 100644 --- a/matrix/src/TMatrixT.cxx +++ b/matrix/src/TMatrixT.cxx @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TMatrixT.cxx,v 1.4 2005/12/23 07:20:10 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TMatrixT.cxx,v 1.5 2005/12/23 19:55:50 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Nov 2003 /************************************************************************* @@ -135,7 +135,7 @@ TMatrixT<Element>::TMatrixT(EMatrixCreatorsOp1 op,const TMatrixT<Element> &proto *this = prototype; // Since the user can not control the tolerance of this newly created matrix // we put it to the smallest possible number - const Element oldTol = this->SetTol(DBL_MIN); + const Element oldTol = this->SetTol(std::numeric_limits<Element>::min()); this->Invert(); this->SetTol(oldTol); break; @@ -181,7 +181,7 @@ TMatrixT<Element>::TMatrixT(const TMatrixT<Element> &a,EMatrixCreatorsOp2 op,con Allocate(a.GetNrows(),a.GetNcols(), a.GetRowLwb(),a.GetColLwb(),1); *this = a; - const Element oldTol = this->SetTol(DBL_MIN); + const Element oldTol = this->SetTol(std::numeric_limits<Element>::min()); this->Invert(); this->SetTol(oldTol); *this *= b; @@ -238,7 +238,7 @@ TMatrixT<Element>::TMatrixT(const TMatrixT<Element> &a,EMatrixCreatorsOp2 op,con Allocate(a.GetNrows(),a.GetNcols(), a.GetRowLwb(),a.GetColLwb(),1); *this = a; - const Element oldTol = this->SetTol(DBL_MIN); + const Element oldTol = this->SetTol(std::numeric_limits<Element>::min()); this->Invert(); this->SetTol(oldTol); *this *= b; @@ -295,7 +295,7 @@ TMatrixT<Element>::TMatrixT(const TMatrixTSym<Element> &a,EMatrixCreatorsOp2 op, Allocate(a.GetNrows(),a.GetNcols(), a.GetRowLwb(),a.GetColLwb(),1); *this = a; - const Element oldTol = this->SetTol(DBL_MIN); + const Element oldTol = this->SetTol(std::numeric_limits<Element>::min()); this->Invert(); this->SetTol(oldTol); *this *= b; @@ -352,7 +352,7 @@ TMatrixT<Element>::TMatrixT(const TMatrixTSym<Element> &a,EMatrixCreatorsOp2 op, Allocate(a.GetNrows(),a.GetNcols(), a.GetRowLwb(),a.GetColLwb(),1); *this = a; - const Element oldTol = this->SetTol(DBL_MIN); + const Element oldTol = this->SetTol(std::numeric_limits<Element>::min()); this->Invert(); this->SetTol(oldTol); *this *= b; @@ -472,7 +472,7 @@ void TMatrixT<Element>::Allocate(Int_t no_rows,Int_t no_cols,Int_t row_lwb,Int_t this->fColLwb = col_lwb; this->fNelems = this->fNrows*this->fNcols; this->fIsOwner = kTRUE; - this->fTol = DBL_EPSILON; + this->fTol = std::numeric_limits<Element>::epsilon(); if (this->fNelems > 0) { fElements = New_m(this->fNelems); diff --git a/matrix/src/TMatrixTSparse.cxx b/matrix/src/TMatrixTSparse.cxx index d8f2ecb4aebe81c46179a1729c37b812e5ed4f01..84f287b8d6686244a8437bac5f0c123898e9bfcc 100644 --- a/matrix/src/TMatrixTSparse.cxx +++ b/matrix/src/TMatrixTSparse.cxx @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TMatrixTSparse.cxx,v 1.1 2005/12/22 09:27:57 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TMatrixTSparse.cxx,v 1.2 2005/12/23 19:55:50 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Feb 2004 /************************************************************************* @@ -249,7 +249,7 @@ void TMatrixTSparse<Element>::Allocate(Int_t no_rows,Int_t no_cols,Int_t row_lwb this->fNrowIndex = this->fNrows+1; this->fNelems = nr_nonzeros; this->fIsOwner = kTRUE; - this->fTol = DBL_EPSILON; + this->fTol = std::numeric_limits<Element>::epsilon(); fRowIndex = new Int_t[this->fNrowIndex]; if (init) @@ -1590,7 +1590,7 @@ TMatrixTSparse<Element> &TMatrixTSparse<Element>::Use(Int_t row_lwb,Int_t row_up this->fNrowIndex = this->fNrows+1; this->fNelems = nr_nonzeros; this->fIsOwner = kFALSE; - this->fTol = DBL_EPSILON; + this->fTol = std::numeric_limits<Element>::epsilon(); fElements = pData; fRowIndex = pRowIndex; diff --git a/matrix/src/TMatrixTSym.cxx b/matrix/src/TMatrixTSym.cxx index 0df91f78a73fc8fc0d4c6fedcad296add4a94afd..20070c843593b68971de50644ab6a0308a3b8221 100644 --- a/matrix/src/TMatrixTSym.cxx +++ b/matrix/src/TMatrixTSym.cxx @@ -1,4 +1,4 @@ -// @(#)root/matrix:$Name: $:$Id: TMatrixTSym.cxx,v 1.2 2005/12/23 07:20:10 brun Exp $ +// @(#)root/matrix:$Name: $:$Id: TMatrixTSym.cxx,v 1.3 2005/12/23 19:55:50 brun Exp $ // Authors: Fons Rademakers, Eddy Offermann Nov 2003 /************************************************************************* @@ -128,7 +128,7 @@ TMatrixTSym<Element>::TMatrixTSym(EMatrixCreatorsOp1 op,const TMatrixTSym<Elemen *this = prototype; // Since the user can not control the tolerance of this newly created matrix // we put it to the smallest possible number - const Element oldTol = this->SetTol(DBL_MIN); + const Element oldTol = this->SetTol(std::numeric_limits<Element>::min()); this->Invert(); this->SetTol(oldTol); break; @@ -289,7 +289,7 @@ void TMatrixTSym<Element>::Allocate(Int_t no_rows,Int_t no_cols,Int_t row_lwb,In this->fColLwb = col_lwb; this->fNelems = this->fNrows*this->fNcols; this->fIsOwner = kTRUE; - this->fTol = DBL_EPSILON; + this->fTol = std::numeric_limits<Element>::epsilon(); if (this->fNelems > 0) { fElements = New_m(this->fNelems);