I started writing some functions (https://github.com/billtubbs/array_funcs) to vectorize basic algebra operations for Micropython arrays.
Example:
Code: Select all
@micropython.asm_thumb
def float_array_square(r0, r1):
label(LOOP)
vldr(s0, [r0, 0])
vmul(s0, s0, s0)
vstr(s0, [r0, 0])
add(r0, 4)
sub(r1, 1)
bgt(LOOP)
In other words how do I call the underlying routines in math.pow from assembler to make a vectorized version of the following:
Code: Select all
def float_array_power(x, n, y):
for i in range(n):
x[i] = math.pow(x[i], y)