Hi all,
I wonder if it would be easy to implement all std methods to be able to run smoothly with RVec
?
I would find it very useful.
What I mean is able to run something like this:
import ROOT
df = ROOT.RDataFrame(1)
df = df.Define("x", "ROOT::VecOps::RVec<double> {-2, -1, -0, 1, 2}")
# get the same as df = df.Define("x2", "x*x")
df = df.Define("x2", "std::pow(x)")
# get the same as df = df.Define("x_abs", "x*(x >0)")
df = df.Define("x_abs", "std::abs(x)")
# well, why not this
df = df.Define("x_sin", "std::sin(x)")
# or this
df = df.Define("x_sqrt", "std::sqrt(x)")
# or even this?
df = df.Define("x_do_smart_math_thing", "std::sqrt(x*x) + 3* std::tan(x)*std::tan(x)")
These all are rather standard mathematical operations as well as +
, -
, *
, /
.
Is it possible to implement something like this for RVec
as it was done for operator overloading, so user doesn’t create a lambda function for each of these cases?
cheers,
Bohdan