input slice
1-dimensional slice composed of antidiagonal elements.
auto antidiagonal = slice.dropToHypercube.reversed!1.diagonal;
// ----- // | 0 1 | // | 2 3 | // ----- //-> // | 1 2 | static immutable c = [1, 2]; import std.stdio; assert(iota(2, 2).antidiagonal == c);
// ------- // | 0 1 2 | // | 3 4 5 | // ------- //-> // | 1 3 | static immutable d = [1, 3]; assert(iota(2, 3).antidiagonal == d);
Returns a 1-dimensional slice over the main antidiagonal of an 2D-dimensional slice. antidiagonal can be generalized with other selectors such as blocks (diagonal blocks) and windows (multi-diagonal slice).
It runs from the top right corner to the bottom left corner.