the function:
friend TVector operator*(TMatrix &m, TVector &v)
is not implemented. Since this kind of operators need to
return an object instead of a reference they are quite
expensive. In your case do something like this:
TVector a(2), b(2);
TMatrix m(2,2);
// init a and m
b = a;
b *= m;
Cheers, Fons.
PS: check the $ROOTSYS/test/vvector.cxx and vmatrix.cxx
programs to see what is possible with vectors and matrices.
PS2: I've still to verify what happens in the interpreter (why there
is no explicit message)
Pasha Murat wrote:
>
> Hello,
>
> I just tried to multiply TVector by TMatrix:
> ---------------------------------------- test.C
> {
> TVector a(2);
> a(0) = 1.;
> a(1) = 2.;
> cout << " ---------------------------------------- vector a: "; a.Print();
>
> TMatrix m(2,2);
> m(0,0) = 2.;
> m(1,1) = 2.;
> cout << " ---------------------------------------- matrix m: "; m.Print();
>
> TVector b(2);
>
> b = m*a;
> cout << " ---------------------------------------- vector b = m*a: ";b.Print();
>
> b = a*m;
> cout << " ---------------------------------------- vector b = a*m: ";b.Print();
>
> }
> -------------------------------------------
> with the following result (see below), which shows that `b' is not being
> defined.
> Am I missing something?
> Thanks, Pasha.
> --------------------------------------------------------------------------------
> root [2] .x test.C
> ---------------------------------------- vector a:
> Vector 2 is as follows
>
> | 1 |
> ------------------
> 0 | 1
> 1 | 2
>
> ---------------------------------------- matrix m:
> Matrix 2x2 is as follows
>
> | 0 | 1 |
> ------------------------------------------------------------------
> 0 | 2 0
> 1 | 0 2
>
> ---------------------------------------- vector b = m*a:
> Vector 2 is as follows
>
> | 1 |
> ------------------
> 0 | 0
> 1 | 0
>
> ---------------------------------------- vector b = a*m:
> Vector 2 is as follows
>
> | 1 |
> ------------------
> 0 | 0
> 1 | 0
> --------------------------------------------------------------------------------
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910