TMatrixD usage

From: Sara Knaack <sknaack_at_uiuc.edu>
Date: Sun, 16 Dec 2007 22:49:54 -0600


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 - 05:50:27 CET

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