Hello, I'm trying to do some mulitplications of matrices. I have a column-vector V (it's a TVector) and its error-matrix M, which is a TMatrix. Now I'd like to calculate: V^T * M * V, where V^T is the transposed vector of V (i.e. it's a row-vector). Currently I haven't found a better way to do this than to 1) Create a TMatrix "Vmat" with a single column and by hand copy all the elements of V in there. 2) Then do this: TMatrix result(Vmat, kTransposeMult, TMatrix(M,kMult,Vmat) ); The resulting matrix "result" will have one entry. Is there a better way that avoids copying by hand, and calling the TMatrix constructor twice (of which once it's for a TMatrix of a single element)? I think the problem arises because a) I have a TVector but I want to use it as a column of a matrix (i.e. as a TMatrixColumn) b) there are no operations involving TMatrix and a TMatrixColumn/TMatrixRow implemented anywhere Finally, I think: problem a) could be solved adding an assignment operator to TMatrixColumn & TMatrixRow that takes a TVector (there is already such an operator in TVector, taking a TMatrixColumn), and problem b) could be solved by deriving TMatrixColumn and TMatrixRow from TMatrix (or allow the user to obtain the TMatrix* from a TMatrixColumn/Row, perhaps easier to implement but IMHO less elegant). But anyway, my question is, is there a better way to do the calculation above? Thanks, Paul Balm
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET