Wondering what is the simplest way to multiply a vector by its transpose and get its characteristic matrix in ROOT.
Such as it could be TVectorD V;
TMatrixD M = V * V.T();
where V.T()
would be the transpose, V would be a 3 component vector, and the product M
would result in a 3x3 matrix.
I had a look here,
https://root.cern/doc/master/group__tutorial__matrix.html
but not clear to me what would be the simplest way. Do I need to work only with TMatrixD
?
Int_t test() {
Double_t d[] = {1.0, 2.0, 3.0};
TVectorD a;
a.Use(3, d);
TMatrixD D(3, 3);
TMatrixDColumn(D, 0) = a;
TMatrixD Dt(3, 3);
TMatrixDRow(Dt, 0) = a;
D.Print();
Dt.Print();
TMatrixD P = D * Dt;
P.Print();
return 0;
}
There is any optimal way to interface with a TVector3
?