The OpenD Programming Language

padWrap

Pads with the wrap of the slice along the axis. The first values are used to pad the end and the end values are used to pad the beginning.

  1. auto padWrap(Slice!(Iterator, N, kind) s, size_t[dimensions.length] lengths)
    template padWrap(size_t[] dimensions, string[] directions)
    padWrap
    (
    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 padWrap(Slice!(Iterator, N, kind) s, size_t[N] lengths)

Members

Functions

padWrap
auto padWrap(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)
    .padWrap!([1], ["pre"])([1])
    .slice;

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

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

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

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

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

See Also

._concatenation examples.

Meta