I’m trying to do a linear least square using TDecompSVD (following root.cern.ch/root/html/tutorial … ear.C.html), but it doesn’t work and I can’t figure out how to write it correctly in python.
I defined a TMatrix (A) and a TVector (y).
svd = ROOT.TDecompSVD(A)
ok = bool()
x = svd.Solve(y, ok)
Gives:
[quote]TVectorD TDecompSVD::Solve(const TVectorD& b, Bool_t& ok) =>
could not convert argument 2[/quote]
A solution would be to use numpy instead, but any idea on this?
the only way right now to make this work is to wrap this in a C++ helper that deals with the bool reference. You can pass a dummy (“import array; dummy = array.array(‘b’, [0])”) which will make the call work, but you won’t get a return value that way.
By-ref of builtins is generally not well supported. Only ones that work are type that are the same in C++ as in Python (int, long, and double).
This can be improved with Cling (by generating the C++ helper), but is a TODO.