[ROOT] Strange behavior with TMatrixD

From: Nicolas Arnaud (narnaud@lal.in2p3.fr)
Date: Tue Mar 23 2004 - 19:52:50 MET


Hi rooters,

I have a problem with an object of type TMatrixD. I could isolate it and so wrote a short 
code -- testMatrixD.cc, see below -- to reproduce the problem.

In short: the instruction

      mat( row, col ) = 10 * row + col;

is OK when mat is a TMatrixD, but not when mat is a TMatrixD*.

Indeed:

// TMatrixD case
----------------

.x testMatrixD.cc++

I get the normal root output:

(int)0

// TMatrixD* case
-----------------

.x testMatrixD.cc++

I have a compilation error:

/home/narnaud/BaBar/Root/testMatrixD.cc: In function `int testMatrixD()':
/home/narnaud/BaBar/Root/testMatrixD.cc:32: `mat' cannot be used as a function

On the other hand, when I simply run the code interactively with

.x testMatrixD.cc

everything works well in both cases!

Any idea on what's wrong with my file?

Thanks in advance,

Nicolas

PS I'm using ROOT 3.10/02 on linux.

code testMatrixD.cc
-------------------

#ifndef __CINT__

#include <TROOT.h>
#include <TSystem.h>

#include <stdlib.h>
#include <stdio.h>
#include <Riostream.h>

int testMatrixD();

int main()
{
  return testMatrixD();
}

#endif

#include <TMatrixD.h>

int testMatrixD()
{
  // matrix
  //TMatrixD mat( 2, 2 );

  // pointer on a matrix
  TMatrixD *mat;
  mat = new TMatrixD( 2, 2 );

  for( int row = 0 ; row < 2 ; row ++ ) {
    for( int col = 0 ; col < 2 ; col ++ ) {
      mat( row, col ) = 10 * row + col;
    }
  }

  return( 0 );
}



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET