Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

padStack #1

Closed
9il opened this issue Mar 6, 2017 · 6 comments
Closed

padStack #1

9il opened this issue Mar 6, 2017 · 6 comments

Comments

@9il
Copy link
Member

9il commented Mar 6, 2017

This issue is successor for libmir/mir#311.

@9il 9il changed the title paddingStack padStack Mar 6, 2017
@9il
Copy link
Member Author

9il commented Mar 6, 2017

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.

@9il
Copy link
Member Author

9il commented Mar 7, 2017

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),
		);
}

@9il
Copy link
Member Author

9il commented Mar 7, 2017

Hmm, probably we can add a multidimensional version to mir-algorithm

@ljubobratovicrelja
Copy link
Member

Nice! :)

Hmm, probably we can add a multidimensional version to mir-algorithm

I agree!

@9il
Copy link
Member Author

9il commented Mar 9, 2017

constant padding was added libmir/mir-algorithm#31

@9il
Copy link
Member Author

9il commented Mar 9, 2017

edge, symmetric and wrap paddings libmir/mir-algorithm#32

@9il 9il closed this as completed Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants