Hi,
I’m trying to create and manipulate a TMatrixD in PyRoot.
In Cint, I just do
root [1] TMatrixD cov(2,2)
root [2] cov(0,0)
(double)0.00000000000000000e+00
root [3] cov(0,0)=1
(const int)1
But this doesn’t work in PyRoot:
>>> import ROOT
>>> cov = ROOT.TMatrixD (2,2)
>>> cov(0,0)
0.0
>>> cov(0,0) = 2
Are you trying to assign a value to a reference return, for example to the
result of a call to "double& SMatrix<>::operator()(int,int)"? If so, then
please use operator[] instead, as in e.g. "mymatrix[i,j] = somevalue".
File "<stdin>", line 1
SyntaxError: can't assign to function call
>>>
As far as I can tell, the only way to set the matrix is by calling operator() which returns a reference. But this doesn’t work in Python, so what can I do?
Thanks,
Charles