The OpenD Programming Language

padSymmetric

Pads with the reflection of the slice mirrored along the edge of the slice.

  1. auto padSymmetric(Slice!(Iterator, N, kind) s, size_t[dimensions.length] lengths)
    template padSymmetric(size_t[] dimensions, string[] directions)
    padSymmetric
    (
    Iterator
    size_t N
    SliceKind kind
    )
    (
    Slice!(Iterator, N, kind) s
    ,
    size_t[dimensions.length] lengths...
    )
    if (
    dimensions.length &&
    dimensions.length == directions.length
    )
  2. auto padSymmetric(Slice!(Iterator, N, kind) s, size_t[N] lengths)

Members

Functions

padSymmetric
auto padSymmetric(Slice!(Iterator, N, kind) s, size_t[dimensions.length] lengths)

Parameters

dimensions

dimensions to pad.

directions

padding directions. Direction can be one of the following values: "both", "pre", and "post".

Return Value

Examples

import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;

auto pad = iota([2, 3], 1)
    .padSymmetric!([1], ["pre"])([2])
    .slice;

assert(pad == [
    [2, 1,  1, 2, 3],
    [5, 4,  4, 5, 6]]);
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;

auto pad = iota([2, 2], 1)
    .padSymmetric!([0, 1], ["both", "post"])([2, 1])
    .slice;

assert(pad == [
    [3, 4,  4],
    [1, 2,  2],

    [1, 2,  2],
    [3, 4,  4],

    [3, 4,  4],
    [1, 2,  2]]);

See Also

._concatenation examples.

Meta