I am interested in creating custom structs, creating associated overloaded functions, and compiling numba device functions for a targeted type. I am wondering if function overloading is possible in any fashion.
If a user defines an example function as follows
def sphere(x,y,z): return sqrt(x*x + y*y + z*z) - 2
I would like to compile said function where x,y, and z are scalars and again with them as structures. I can define addition and subtraction for the structure but I run into a little trouble when sqrt is used. Is there a way to declare functions (they can all be pre-declared before a user creates their own function) similar to the Templates Numba uses (i.e. ConcreteTemplate) where I specify the input and return types and have the Numba compiler pick the correct sqrt function behind the scenes depending on what types I use? The reason I even ask is it looks like the key to a template is the function itself so it doesn’t look like I can have the same function key point to multiple overloaded functions based on the signature.