Hi Nicolas,
As you probably know, you can apply operations on the TMatrix (and TVector)
through a class derived from TElementPosAction. So here two classes
that allow you fill and extract from a TMatrix:
class FillMatrix : public TElementPosAction
{
Int_t fnrCols;
Double_t *fArray;
inline void Operation(Double_t &element) { element = fArray[fI*fnrCols+fJ]; }
public:
FillMatrix(const TMatrix &m, TArrayD &a) :
fnrCols(m.GetNcols()) { fArray=a.GetArray(); }
};
class ExtractMatrix : public TElementPosAction
{
Int_t fno_cols;
Double_t *fArray;
inline void Operation(Double_t &element) { fArray[fI*fno_cols+fJ] = element; }
public:
ExtractMatrix(const TMatrix &m,Double_t *a) :
fno_cols(m.GetNcols()) { fArray=a; }
};
:
TArrayD corr(...);
FillMatrix f(x,corr.GetArray());
x.Apply(f);
:
:
:
TArrayD nrho(...);
ExtractMatrix e(x,nrho.GetArray());
x.Apply(e);
:
To the ROOT team:
1) could you please please make the TMatrix and
TVector elements Double_t, all it takes is a global Real_t to Double_t in
MATRIX_Matrix.cxx MATRIX_Vector.cxx TMatrixUtils.h
MATRIX_MatrixUtils.cxx TMatrix.h TVector.h
In my version, I did it and it works fine.
2) Getting access to and filling of TMatrix/TVector with pointers like
in TArray (GetArray() ..) would be helpful too.
Eddy
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET