This PR contains correlate, correlate1d, convolve and convolve1d. I had to modify pad a little to:
add a pad_to function to avoid allocating
add a left pad and right pad [usize; 2] given in a vector
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.
This PR contains
correlate
,correlate1d
,convolve
andconvolve1d
. I had to modifypad
a little to:pad_to
function to avoid allocating[usize; 2]
given in a vectorThe 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
andconvolve
functions, I can say at last that this version is faster than SciPy! If we ever makepad
faster, this will make all other functions faster...My only problem with this PR is that
convolve1d
andcorrelate1d
only support Float datatypes. I'm still searching how to support all datatypes.