Closed 9il closed 7 years ago
padStack
should return a mir.ndslice.stack.Stack
. Then mir.ndslice.topology: indexed, ndiota
can be used to construct a lazy view, or slice
can be used to allocate new image.
Draft for 2D:
auto pad(S)(S slice, size_t l0, size_t l1)
{
auto e = slice[0 .. $, 0 .. $]; //if contiguous then canonical
auto b = e[0 .. l0].reversed!0;
auto h = e.reversed!0[0 .. l0];
auto d = e[0 .. $, 0 .. l1].retro.reversed!0;
auto f = e.retro.reversed!0[0 .. $, 0 .. l1];
auto a = d[0 .. l0].reversed!0;
auto c = f[0 .. l0].reversed!0;
auto g = d.reversed!0[0 .. l0];
auto k = f.reversed!0[0 .. l0];
return
stack!0(
stack!1(a, b, c),
stack!1(d, e, f),
stack!1(g, h, k),
);
}
Hmm, probably we can add a multidimensional version to mir-algorithm
Nice! :)
Hmm, probably we can add a multidimensional version to mir-algorithm
I agree!
constant padding was added https://github.com/libmir/mir-algorithm/pull/31
edge, symmetric and wrap paddings https://github.com/libmir/mir-algorithm/pull/32
This issue is successor for https://github.com/libmir/mir/issues/311.