Re: Direct product of matrices.

From: Edmond Offermann <edmondoffermann_at_yahoo.com>
Date: Tue, 30 Jan 2007 18:25:02 -0800 (PST)


Hi Art,

Your expression is highly dependent on the order of execution:

TMatrixD B(n,n);
B=A*A.T();

A.T() is transposing A in place , if the compiler performs that before the product,
the dimensions of the matrices are incompatible . You can accomplish the
operation as follows :

where the first method creates the least temporary objects .

Eddy

> Hi Rene et al.,
>
>
> Direct product of matrices which worked with HepMatrix does seem to
> work
> for TMatrix.
>
> That is if I do
>
> TMatrixD A(n,1);
> then set a to some falues
>
> TMatrixD B(n,n);
> B=A*A.T()
>
> it fails. Error message if about rows and columns not matching.
>
> This worked with HepMatrix and is useful, for example, in
> constructing
> array of derivatives that enters some fits.
>
> Is this a bug or a feature? Or am I doing something wrong?
>
> It not hard to write my own direct product function but it looks
> ugly...
>
> -Art S.
>
>
>
> A.E. Snyder, Group EC \!c*p?/
> SLAC Mail Stop #95 ((. .))
> Box 4349 |
> Stanford, Ca, USA, 94309 '\|/`
> e-mail:snyder_at_slac.stanford.edu o
> phone:650-926-2701 _
> http://www.slac.stanford.edu/~snyder BaBar
> FAX:650-926-2657 Collaboration
>
>
>
>
Received on Wed Jan 31 2007 - 03:25:17 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 31 2007 - 11:50:01 CET