v923z / micropython-ulab

a numpy-like fast vector module for micropython, circuitpython, and their derivatives
https://micropython-ulab.readthedocs.io/en/latest
MIT License
403 stars 111 forks source link

[FEATURE REQUEST] add numpy.correlate #600

Open v923z opened 1 year ago

v923z commented 1 year ago

As described in https://github.com/v923z/micropython-ulab/discussions/597, add the C implementation of https://numpy.org/doc/stable/reference/generated/numpy.correlate.html

@hamza-712

v923z commented 1 year ago

@hamza-712 Actually, you can already calculate the correlation of two arrays by flipping one of them, and calling convolve. Would that not work for you? If you use slices as in a[::-1], then you don't even waste RAM, because the slice is just a view, so no memory allocation takes place.

hamza-712 commented 1 year ago

@v923z Thanks, I've implemented just like you said.