imeka / ndarray-ndimage

Multidimensional image processing for ndarray
Apache License 2.0
14 stars 2 forks source link

Correlate and Convolve #5

Closed nilgoyette closed 2 years ago

nilgoyette commented 2 years ago

This PR contains correlate, correlate1d, convolve and convolve1d. I had to modify pad a little to:

The Symmetry thing is not super useful in this Rust version! We're only slightly faster with a Symmetric ot AntiSymmetric kernel. In SciPy, there's an immense gain, but not here.

Benchmarking the SciPy version seems quite random. I had results going from 30ms to 60ms. This Rust version is slower than the best SciPy time, but faster than the worst and the mean. I'm not sure which time to use.

As for the correlate and convolve functions, I can say at last that this version is faster than SciPy! If we ever make pad faster, this will make all other functions faster...

My only problem with this PR is that convolve1d and correlate1d only support Float datatypes. I'm still searching how to support all datatypes.