Nesting Numba functions

Is there a way to call another function from within a Numba-declared function? I cannot seem to find a way.

For example,

import numpy as np
import ROOT as r

def test1(i):
    return np.array([i])

@r.Numba.Declare(["int"], "RVec<int>")
def test2(i):
    return test1(i)

results in Untyped global name 'test1': Cannot determine Numba type of <class 'function'>.

import numpy as np
import ROOT as r

@r.Numba.Declare(["int"], "RVec<int>")
def test1(i):
    return np.array([i])

@r.Numba.Declare(["int"], "RVec<int>")
def test2(i):
    return test1(i)

results in the same thing.

By contrast,

import numpy as np
import ROOT as r

@r.Numba.Declare(["int"], "RVec<int>")
def test1(i):
    return np.array([i])

@r.Numba.Declare(["int"], "RVec<int>")
def test2(i):
    return r.Numba.test1(i)

results in No conversion from CppClass(ROOT::VecOps::RVec<int>) to array(int32, 1d, A) for '$64return_value.6', defined at None.

Is there any way to call a function from within a Numba declared function?


ROOT Version: 6.34/06
Platform: macOS
Compiler: (conda forge)


Hello,

Thanks for the post. Let me add in the loop our Numba expert, @ajomy !

Cheers,
Danilo