From 9b5328dfee8eadf9dad9fb91927e752ed3fcb509 Mon Sep 17 00:00:00 2001 From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch> Date: Thu, 9 Mar 2006 09:24:04 +0000 Subject: [PATCH] - rename apply(i,j) to operator(i,j) in expression and function classes due to some bizarre conflicts with apply(i) found on Windows. - rename linking warning in testSMatrix on Windows git-svn-id: http://root.cern.ch/svn/root/trunk@14209 27541ba8-7e3a-0410-8455-c3a389f83636 --- smatrix/inc/Math/Expression.h | 18 +++++++++--------- smatrix/inc/Math/HelperOps.h | 8 ++++---- smatrix/inc/Math/MatrixFunctions.h | 12 ++++++------ smatrix/inc/Math/SMatrix.h | 3 +-- smatrix/inc/Math/SMatrix.icc | 5 +---- smatrix/test/Makefile | 6 +++++- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/smatrix/inc/Math/Expression.h b/smatrix/inc/Math/Expression.h index 0710c1505f4..6c5519bc3fa 100644 --- a/smatrix/inc/Math/Expression.h +++ b/smatrix/inc/Math/Expression.h @@ -1,4 +1,4 @@ -// @(#)root/smatrix:$Name: $:$Id: Expression.h,v 1.6 2006/03/08 15:11:06 moneta Exp $ +// @(#)root/smatrix:$Name: $:$Id: Expression.h,v 1.7 2006/03/08 17:39:47 moneta Exp $ // Authors: T. Glebe, L. Moneta 2005 #ifndef ROOT_Math_Expression @@ -127,8 +127,8 @@ public: inline T apply(unsigned int i) const { return rhs_.apply(i); } - inline T apply(unsigned int i, unsigned j) const { - return rhs_.apply(i,j); + inline T operator() (unsigned int i, unsigned j) const { + return rhs_(i,j); } @@ -155,7 +155,7 @@ public: for (unsigned int i=0; i < D; ++i) { unsigned int d2 = D2; // to avoid some annoying warnings in case of vectors (D2 = 0) for (unsigned int j=0; j < D2; ++j) { - os << std::setw(12) << apply(i,j); + os << std::setw(12) << this->operator() (i,j); if ((!((j+1)%12)) && (j < d2-1)) os << std::endl << " ..."; } @@ -207,8 +207,8 @@ public: inline T apply(unsigned int i) const { return Operator::apply(lhs_.apply(i), rhs_.apply(i)); } - inline T apply(unsigned int i, unsigned int j) const { - return Operator::apply(lhs_.apply(i,j), rhs_.apply(i,j)); + inline T operator() (unsigned int i, unsigned int j) const { + return Operator::apply(lhs_(i,j), rhs_(i,j) ); } protected: @@ -247,8 +247,8 @@ public: inline T apply(unsigned int i) const { return Operator::apply(rhs_.apply(i)); } - inline T apply(unsigned int i, unsigned int j) const { - return Operator::apply(rhs_.apply(i,j)); + inline T operator() (unsigned int i, unsigned int j) const { + return Operator::apply(rhs_(i,j)); } protected: @@ -284,7 +284,7 @@ public: /// inline T apply(unsigned int /*i */ ) const { return rhs_; } - inline T apply(unsigned int /*i */, unsigned int /*j */ ) const { return rhs_; } + inline T operator() (unsigned int /*i */, unsigned int /*j */ ) const { return rhs_; } protected: diff --git a/smatrix/inc/Math/HelperOps.h b/smatrix/inc/Math/HelperOps.h index c9e501d9c74..00deef7f7e6 100644 --- a/smatrix/inc/Math/HelperOps.h +++ b/smatrix/inc/Math/HelperOps.h @@ -1,4 +1,4 @@ -// @(#)root/smatrix:$Name: $:$Id: HelperOps.h,v 1.1 2006/02/08 14:45:35 moneta Exp $ +// @(#)root/smatrix:$Name: $:$Id: HelperOps.h,v 1.2 2006/03/08 15:11:06 moneta Exp $ // Authors: J. Palacios 2006 #ifndef ROOT_Math_HelperOps_h @@ -42,7 +42,7 @@ namespace ROOT { unsigned int l = 0; for(unsigned int i=0; i<D1; ++i) for(unsigned int j=0; j<D2; ++j) { - lhs.fRep[l] = rhs.apply(i,j); + lhs.fRep[l] = rhs(i,j); l++; } } @@ -70,7 +70,7 @@ namespace ROOT { unsigned int l = 0; for(unsigned int i=0; i<D1; ++i) for(unsigned int j=0; j<D2; ++j) { - lhs.fRep[l] += rhs.apply(i,j); + lhs.fRep[l] += rhs(i,j); l++; } } @@ -97,7 +97,7 @@ namespace ROOT { unsigned int l = 0; for(unsigned int i=0; i<D1; ++i) for(unsigned int j=0; j<D2; ++j) { - lhs.fRep[l] -= rhs.apply(i,j); + lhs.fRep[l] -= rhs(i,j); l++; } } diff --git a/smatrix/inc/Math/MatrixFunctions.h b/smatrix/inc/Math/MatrixFunctions.h index 4bc9fe3d125..21ebea97a39 100644 --- a/smatrix/inc/Math/MatrixFunctions.h +++ b/smatrix/inc/Math/MatrixFunctions.h @@ -1,4 +1,4 @@ -// @(#)root/smatrix:$Name: $:$Id: MatrixFunctions.h,v 1.6 2006/02/28 13:45:05 moneta Exp $ +// @(#)root/smatrix:$Name: $:$Id: MatrixFunctions.h,v 1.7 2006/03/08 15:11:06 moneta Exp $ // Authors: T. Glebe, L. Moneta 2005 #ifndef ROOT_Math_MatrixFunctions @@ -256,7 +256,7 @@ struct meta_matrix_dot { const MatrixB& rhs, unsigned int i, unsigned int j) { - return lhs.apply(i, I) * rhs.apply(I , j) + + return lhs(i, I) * rhs(I , j) + meta_matrix_dot<I-1>::g(lhs,rhs,i,j); } }; @@ -281,7 +281,7 @@ struct meta_matrix_dot<0> { static inline typename MatrixA::value_type g(const MatrixA& lhs, const MatrixB& rhs, unsigned int i, unsigned int j) { - return lhs.apply(i,0) * rhs.apply(0,j); + return lhs(i,0) * rhs(0,j); } }; @@ -304,7 +304,7 @@ public: return meta_matrix_dot<D-1>::f(lhs_, rhs_, i); } - inline T apply(unsigned int i, unsigned j) const { + inline T operator() (unsigned int i, unsigned j) const { return meta_matrix_dot<D-1>::g(lhs_, rhs_, i, j); } @@ -441,8 +441,8 @@ public: inline T apply(unsigned int i) const { return rhs_.apply( (i%D1)*D2 + i/D1); } - inline T apply(unsigned int i, unsigned j) const { - return rhs_.apply( j, i); + inline T operator() (unsigned int i, unsigned j) const { + return rhs_( j, i); } protected: diff --git a/smatrix/inc/Math/SMatrix.h b/smatrix/inc/Math/SMatrix.h index 2a101b2fc6b..7a08ed00c91 100644 --- a/smatrix/inc/Math/SMatrix.h +++ b/smatrix/inc/Math/SMatrix.h @@ -1,4 +1,4 @@ -// @(#)root/smatrix:$Name: $:$Id: SMatrix.h,v 1.12 2006/02/27 18:41:58 moneta Exp $ +// @(#)root/smatrix:$Name: $:$Id: SMatrix.h,v 1.13 2006/03/08 15:11:06 moneta Exp $ // Authors: T. Glebe, L. Moneta 2005 #ifndef ROOT_Math_SMatrix @@ -187,7 +187,6 @@ public: /** @name --- Access functions --- */ /// access the parse tree T apply(unsigned int i) const; - T apply(unsigned int i, unsigned j) const; /// return read-only pointer to internal array const T* Array() const; diff --git a/smatrix/inc/Math/SMatrix.icc b/smatrix/inc/Math/SMatrix.icc index a0ddd93450c..f04f662a5af 100644 --- a/smatrix/inc/Math/SMatrix.icc +++ b/smatrix/inc/Math/SMatrix.icc @@ -1,4 +1,4 @@ -// @(#)root/smatrix:$Name: $:$Id: SMatrix.icc,v 1.13 2006/02/27 18:41:58 moneta Exp $ +// @(#)root/smatrix:$Name: $:$Id: SMatrix.icc,v 1.14 2006/03/08 15:11:06 moneta Exp $ // Authors: T. Glebe, L. Moneta 2005 #ifndef ROOT_Math_SMatrix_icc @@ -663,9 +663,6 @@ std::ostream& SMatrix<T,D1,D2,R>::Print(std::ostream& os) const { template <class T, unsigned int D1, unsigned int D2, class R> inline T SMatrix<T,D1,D2,R>::apply(unsigned int i) const { return fRep[i]; } -template <class T, unsigned int D1, unsigned int D2, class R> -inline T SMatrix<T,D1,D2,R>::apply(unsigned int i, unsigned j) const { return fRep(i,j); } - template <class T, unsigned int D1, unsigned int D2, class R> inline const T* SMatrix<T,D1,D2,R>::Array() const { return fRep.Array(); } diff --git a/smatrix/test/Makefile b/smatrix/test/Makefile index 268d4baf855..eba79f23aa9 100644 --- a/smatrix/test/Makefile +++ b/smatrix/test/Makefile @@ -14,6 +14,10 @@ ifeq ($(PLATFORM),macosx) CXXFLAGS+= -g endif +ifneq ($(PLATFORM),win32) +LIBM = -lm +endif + TESTSMATRIXOBJ = testSMatrix.$(ObjSuf) @@ -46,7 +50,7 @@ all: $(PROGRAMS) $(TESTSMATRIX): $(TESTSMATRIXOBJ) - $(LD) $(LDFLAGS) $^ -lm $(OutPutOpt)$@ + $(LD) $(LDFLAGS) $^ $(LIBM) $(OutPutOpt)$@ @echo "$@ done" $(TESTOPERATIONS): $(TESTOPERATIONSOBJ) -- GitLab