Index out of bounds on TMatrixDSym using RDataFrame in PyRoot continued

Dear all,

The above topic has been closed but one statement concerning TMatrixDSym or for that matter the whole linear algebra package has to be clarified / corrected.

Enrico stated

Unfortunately, however, it is not possible to assign a TMatrixDSym with a certain shape to a TMatrixDSym with another shape!

As the documentation (once upon a time…) stated this is by design !
Shapes of vectors and matrices can only be changed by invoking “ResizeTo” .

So the correct code would be:

~ root -l
root [0] TMatrixDSym rdf_var; // this is the internal RDF variable, default-constructed
root [1] TMatrixDSym s(3, 4); // this is your `s`
root [2] rdf_var.ResizeTo(3, 4);
root [3] rdf_var = s // does work!


Hi Eddy,
please do suggest improvements to the documentation in an issue or a pull request .

Note that the workaround you suggest cannot easily be applied to solve the original problem, as what happens there is that RDF has templated code that instantiates a variable of type T for every user-defined callable that returns a T, and then it simply assigns rdf_var = user_callable(...) . There is no hook to inject a ResizeTo before every such assignment unless we special-case RDF’s logic in several places for all types that require this.

(The original topic: Index out of bounds on TMatrixDSym using RDataFrame in PyRoot )


Hi Enrico,

I believe that the ROOT team has a week devoted in September to bring the
documentation up to snuff, so there is a plan of action, no need to interfere with a
pull request :wink:

I have not enough knowledge about the RDF implementation but bringing copy assignment operators allowing size changes in the linear algebra does not sound attractive.

best Eddy

I’d say more help than interference, but then an issue might help us not forget (or let’s at least ping @moneta so he’s aware of this discussion)


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.