Re: TMatrixD usage

From: Arthur E. Snyder <snyder_at_slac.stanford.edu>
Date: Sun, 16 Dec 2007 21:14:56 -0800 (PST)


It looks to me like your mytmatrix is a pointer in your example, so you'd need something like

(*mytmatrix)[1][1]=1

..an admittedly awkward notation ..

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



On Sun, 16 Dec 2007, Sara Knaack wrote:

> Dear Rooters,
>
> I am attempting to use the TMatrixD class to define a matrix. Now I
> understand how to create the variable matrix, but I am having problems
> filling the matrix elements. The documentation,
> http://root.cern.ch/root/HowtoCreateMatrix.html, says one should be able to
> use a method of calling the individual elements.
>
> So my code is something like
>
> TMatrixD mymatrix(4,4) ;
> ...
> mymatrix[0][0]=1 ;
> ...
>
> But when I try to load and compile my .cxx file (with ++) it complains about
> the way I have attempted to fill the matrix element. I'm afraid the
> documentation isn't clear to me why this isn't working. Looking at previous
> root e-mails even, this is pretty standard.
>
> I've also tried
>
> TMatricD *mymatrix= new TMatrixD(4,4);
> ...
> mymatrix(0,0) ;
> ...
>
> Is this on the right track? I'm using version 5.16 of Root. I have a similar
> problem if I try to use TArrayD and then send it to the matrix. Does anyone
> using 5.16 have code which fills a matrix with individually defined elements?
> Are there other classes to include in the script that are necessary?
>
> Thanks,
>
> Sara
>
Received on Mon Dec 17 2007 - 06:15:16 CET

This archive was generated by hypermail 2.2.0 : Mon Dec 17 2007 - 11:50:02 CET