I’m doing a rather long tedious matrix manipulation. I have a few things that I would like to understand.
TMatrix does not appear to have a friend with TVector, so I’m assuming that vectors must be declared as TMatrix with dimension 1 by N or N by 1. Is this correct?
When I do the multiplication it appears that a number of temporary TMatrix classes get allocated. Is there any general rules that people suggest to minimize the creation of intermediary TMatrix?
I have declared
TMatrix *H = new TMatrix(6,6)
and
TTMatrix *Xminus = new TMatrix(1,6)
Mutiplying these on the command line appears to work fine. However, when I embed them in a script I get the error:
Error: Can’t call TMatrixD::AmultB((*H),(*Xminus),1) in current scope
TMatrixD::AmultB is a protected function. Use instead the standard TMatrixD constructors, eg in your example replace
TMatrixD X;
X.AmultB ((*H),(*Xminus),1);
by
TMatrixD X(*H, TMatrixDBase::kMult, *Xminus);
hi,
Is it possible to multiply a n x 1 TVectorD by an m x n matrix, when m > n and the vector doesn’t own its own memory? The size of the vector obviously has to increase from m to n, and this doesn’t seem to be possible.
I got around this by coding up matrix multiplication of C++ std vectors which was very easy and intuitive, but it’s not exactly an elegant solution.
Many thanks
Hamish
If[quote}the vector doesn’t own its own memory? The size of the vector obviously has to increase from m to n,[/quote]then you would need to first copy the vector’s value into the a difference vector of the correct larger size …