Hi, I try to figure out how to use use TMatrixD Apply method. Looking at the example in the TMatrixD code (and making some obvious corrections like TElementActionD rather then TElementAction) I get the following piece of code: #include "TMatrixD.h" void foo(TMatrixD &m, TMatrixD &m1) { typedef double (*dfunc_t)(double); class ApplyFunction : public TElementActionD { dfunc_t fFunc; void Operation(Double_t &element) { element=fFunc(element); } public: ApplyFunction(dfunc_t func):fFunc(func) {} }; m.Apply(ApplyFunction(TMath::Sin)); m1.Apply(ApplyFunction(TMath::Cos)); } But trying to compile it I got: g++ -c -Wall -g -D_REENTRANT -I/isdc/sw/root/3.02.07/gcc/2.95.2/include bla.C bla.C: In function `void foo(TMatrixD &, TMatrixD &)': bla.C:11: initialization of non-const reference type `class TElementActionD &' bla.C:11: from rvalue of type `foo(TMatrixD &, TMatrixD &)::ApplyFunction' /isdc/sw/root/3.02.07/gcc/2.95.2/include/TMatrixD.h:337: in passing argument 1 of `TMatrixD::Apply(TElementActionD &)' bla.C:12: initialization of non-const reference type `class TElementActionD &' bla.C:12: from rvalue of type `foo(TMatrixD &, TMatrixD &)::ApplyFunction' /isdc/sw/root/3.02.07/gcc/2.95.2/include/TMatrixD.h:337: in passing argument 1 of `TMatrixD::Apply(TElementActionD &)' Could you hint me a correct way of doing it? Thanks -- Nicolas Produit INTEGRAL Science Data Center Phone: +41 22 950 91 40 16, Chemin d'Ecogia Fax: +41 22 950 91 33 CH-1290 Versoix www: http://isdc.unige.ch/
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:43 MET