___i want to supply data to a TMatrixDSparse object with 6 rows and 5 columns, the TMatrixDSparse object i want is:
here is the code:
TMatrixDSparse matrixs(6,5);
Int_t rowindex[]{0,0,1,3,3,3,4,5,5};
Int_t colindex[]{0,2,1,2,3,4,2,3,4};
const Double_t data[]{3,4,2,8,3,5,5,6,3};
matrixs.SetRowIndexArray(rowindex);
matrixs.SetColIndexArray(colindex);
matrixs.SetMatrixArray(data);
it seems i fail to assign data.
something is wrong with the code?
Please read tips for efficient and successful posting and posting code
ROOT Version: 6.24/02
Platform: Ubuntu 20.04
_Compiler:_GCC 9.3.0
moneta
2
Hi,
This is the correct code. You should use the right signature of SetMatrixArray
for the sparse matrix. See Mathematical libraries - ROOT
{
TMatrixDSparse matrixs(6,5);
Int_t rowindex[]{0,0,1,3,3,3,4,5,5};
Int_t colindex[]{0,2,1,2,3,4,2,3,4};
Double_t data[]{3,4,2,8,3,5,5,6,3};
matrixs.SetMatrixArray(9,rowindex,colindex,data);
matrixs.Print();
}
It seems TMatrixDSparse class has no construtor function like this:
SetMatrixArray(9,rowindex,colindex,data)
moneta
4
system
Closed
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.