Closed
Description
The requirement is that it works with CPython and NumPy, but also compiles using LPython. One option is:
def main():
a: f32[10000] = numpy.empty(10000, dtype=numpy.float32)
b: f32[10000] = numpy.empty(10000, dtype=numpy.float32)
c: f32[10000] = numpy.empty(10000, dtype=numpy.float32)
scalar: f32
i: i32
nsize: i32
scalar = 10
nsize = size(a)
for i in range(nsize): # type: parallel
a[i] = 5
b[i] = 5
triad(a, b, scalar, c)
print("End Stream Triad")
So the syntax is:
a: f32[10000] = numpy.empty(10000, dtype=numpy.float32)
But this is redundant, as the size 10000
is repeated twice and the type f32
and numpy.float32
is also repeated.