Dear colleagues,
in these days I'm using quite extensively the linear algebra package
of ROOT and, in particular, I often need to handle with arrays of
TMatrixD or TVectorD objects. To do this (see the short example class
definition below) I defined an array of TMatrixD/TVectorD pointers and
I manipulate the matrices through them (I'm using version 4.02/00 on a
Red Hat 7.3 with gcc 2.96). Everything WORKS WELL with CINT but
My conclusion is that my style of programming is wrong and it must be a neater way to get the same result (or at least to avoid the CINT shortcut I'm using so to get the code compiled). Can you help me? Thanks a lot,
Francesco.
class ManyMatrix{
public:
ManyMatrix();
private:
TMatrixD* RcurPtr[nsensor]; TMatrixD* m_tmpPtr; TVectorD* r0curPtr[nsensor]; TVectorD* v_tmpPtr;
};
// Constructor
ManyMatrix::ManyMatrix()
{
for (Int_t i=0; i<nsensor; i++){
RcurPtr[i] = new TMatrixD(3,3);
m_tmpPtr=RcurPtr[i]; m_tmpPtr->UnitMatrix(); m_tmpPtr(0,0)=1; m_tmpPtr(1,1)=1; m_tmpPtr(2,2)=1;}
for (Int_t i=0; i<nsensor; i++){
r0curPtr[i] = new TVectorD(3);
v_tmpPtr=r0curPtr[i];
v_tmpPtr(2)=100.;
}
m_tmpPtr->Print();
v_tmpPtr->Print();
}
Info in <TUnixSystem::ACLiC>: creating shared library /home/terranov/opera/muscatt/./manymatrices_C.so In file included from /home/terranov/opera/muscatt/file1GEi2d.h:32,
from /home/terranov/opera/muscatt/./file1GEi2d.cxx:16:/home/terranov/opera/muscatt/./manymatrices.C: In method `ManyMatrix::ManyMatrix ()':
--Received on Fri Mar 11 2005 - 10:38:34 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET