StaticKernels.jl
StaticKernels.jl copied to clipboard
Allow specifying output axes for use with extensions.
Allow more flexibility in output axes. Currently we only allow
- output axes shrinked to applicable domain (no extension)
- output axes matching input (when extension is used)
Discussed in https://github.com/stev47/StaticKernels.jl/discussions/9
Originally posted by RoyiAvital April 29, 2023 Given 2 vectors:
vA = [1, 2, 3, 4, 5];
vB = [4, 5, 6]
I would like to perform their convolution using StaticKernels.jl
.
I would be something like:
vK = Kernel{(0:(length(vB) - 1), )}(@inline vW -> vW[0] * vB[3] + vW[1] * vB[2] + vW[2] * vB[1]);
map(vK, extend(vA, StaticKernels.ExtensionConstant(0)));
The problem is I can get only 5 (the length of the data vA
) elements as output and not length(vA) + length(vB) - 1
.
I was wondering if there a trick to do with the boundary extension to get the output of the full convolution?
In the case above I can define vAA = [0, 0, 1, 2, 3, 4, 5]
and then run on it to get the required result, yet I wonder if it can be done without explicitly extend the vector.