Array of TMatrix

Hi rooters
I faced a problem with

TMatrix am[5];
TMatrix *pam[5];

In first case there is no way to initialize them, in the second one there is no way to access elements as all operations are to be done via overloaded operators.
So, is there any possibility to use array of TMatrix?

I don’t see the problem for the second case since you can always derefence the pointer.

*pam[i] + *pam[j] should do the job.

If you really want, you can even call the operator explicitely:

or, to access an element,


Hi Kir,

The routine

void SetElements(const Real_t* elements, Option_t* option)

will let you set the contents of the matrix by inserting the
array “elements”. Default is to store the array row-wise,
meaning matrix(i,j) = elements[ncolsi+j]. When option = “F”,
it is stored comlumn-wise matrix(i,j) = elements[nrows
j+i] .

The routine

void GetElements(Real_t* elements, Option_t* option)

inserts the matrix contents into the array elements (which
you will have to allocate), where the meaning of option is like
for SetElements.

Through the routines

    const Real_t* GetElements() const    and
            Real_t* GetElements()

one can get access to the bare pointers . However, I discourage
you from using that because you will have to know (and depend) on
the internal storage, which is currently “column-wise”