The OpenD Programming Language

slideAlong

Lazy convolution for tensors.

Suitable for advanced convolution algorithms.

  1. auto slideAlong(Slice!(Iterator, N, kind) slice)
    template slideAlong(size_t params, alias fun, SDimensions...)
    static if(allSatisfy!(isSizediff_t, SDimensions) && params > 1 && __traits(isSame, naryFun!fun, fun))
    slideAlong
    (
    Iterator
    size_t N
    SliceKind kind
    )
    (
    Slice!(Iterator, N, kind) slice
    )
    if (
    params <= 'z' - 'a' + 1 &&
    SDimensions.length > 0
    )
  2. auto slideAlong(S[] slice)
  3. auto slideAlong(S slice)

Members

Functions

slideAlong
auto slideAlong(Slice!(Iterator, N, kind) slice)
auto slideAlong(S[] slice)
auto slideAlong(S slice)

Parameters

params

convolution windows length.

fun

one dimensional convolution function with params arity.

SDimensions

dimensions to perform lazy convolution along. Negative dimensions are supported.

Examples

auto data = [4, 5].iota;

alias scaled = a => a * 0.25;

auto v = data.slideAlong!(3, "a + 2 * b + c", 0).map!scaled;
auto h = data.slideAlong!(3, "a + 2 * b + c", 1).map!scaled;

assert(v == [4, 5].iota[1 .. $ - 1, 0 .. $]);
assert(h == [4, 5].iota[0 .. $, 1 .. $ - 1]);

See Also

Meta