withNeighboursSum

Lazy zip view of elements packed with sum of their neighbours.

  1. auto withNeighboursSum(Slice!(Iterator, N, kind) slice)
    template withNeighboursSum(alias fun = "a + b")
    @optmath
    static if(__traits(isSame, naryFun!fun, fun))
    @optmath
    withNeighboursSum
    (
    Iterator
    size_t N
    SliceKind kind
    )
    (
    Slice!(Iterator, N, kind) slice
    )
  2. auto withNeighboursSum(S[] slice)
  3. auto withNeighboursSum(S slice)
  4. alias withNeighboursSum = .withNeighboursSum!(naryFun!fun)

Members

Aliases

withNeighboursSum
alias withNeighboursSum = .withNeighboursSum!(naryFun!fun)
Undocumented in source.

Functions

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

Parameters

fun

neighbours accumulation function.

Examples

import mir.ndslice.allocation: slice;
import mir.algorithm.iteration: all;

auto wn = [4, 5].iota.withNeighboursSum;
assert(wn.all!"a[0] == a[1] * 0.25");
assert(wn.map!"a" == wn.map!"b * 0.25");

See Also

Meta