TMatrixD* and EigenVector

Hello,

I would like to use an array of TMatrixD with the method EigenVectors. Here is what I have attempted:

[code] TMatrixD* Input[40];
const TMatrixD* Output[40];
for(int t = 0; t < 40; t++) {
Input[t] = new TMatrixD(144,144);
Output[t] = new TMatrixD(144,144);
}


[write to Input]

TVectorD* EV[40];
for(int t = 0; t < 40; t++) {
EV[t] = new TVectorD(144);
}

for(int t = 0; t < 40; t++) {
*Output[t] = Input[t]->EigenVectors(*EV[t]);
}[/code]

The error I get is:

error: no operator "=" matches these operands operand types are: const TMatrixD = const TMatrixT<Double_t> *Output[t] = Input[t]->EigenVectors(*EV[t]);
I am unsure of the proper argument types, so I have tried different combinations in the last line. What is the proper way to write the eigenvalues to EV for all of the objects in the array?

Hi,

this is a C++ issue.
You are trying to assign with the operator= a value to an object qualified as const (const TMatrixD* Output[40] and * Output[t]): this is a flow in your program :frowning:

Cheers,
Danilo

[quote=“dpiparo”]Hi,

this is a C++ issue.
You are trying to assign with the operator= a value to an object qualified as const (const TMatrixD* Output[40] and * Output[t]): this is a flow in your program :frowning:

Cheers,
Danilo[/quote]

Do you mean flaw? All right, well what is the mistake? Assigning TMatrixT<Double_t> to TMatrixD should be acceptable

Sure flaw.
What is not acceptable is to assign to an object marked as const.

Danilo