Is it possible to have a jitclass with overloaded operators that takes another jitclass? Something like:
spec = [
('content', complex128[:]), # a simple scalar field
]
@jitclass(spec)
class Container():
def __init__(content):
self.content = content
@njit(Container(Container, Container))
def __mul__(self,other):
return(Container(np.convolve(self.content, other.content)))
@njit(Container(Container, complex128))
def __mul__(self,other):
return(Container(self.content * other)
@njit(Container(Container, Container))
def __add__(self,other):
return(self.content + other.content)
...
I need this to loop over code segments generated from very long expressions generated with mathematica that are hard to further reformat:
a = [list of Containers]
b = [list of Containers]
c = [list of Containers]
result_list = []
for i in prange(100):
result_list.append(
a[i]*b[i]*c[i]+0.2*d[i]+a[i]*(i+(a[i]+b[i])*c[i])....
)
Thanks!