How to sort 2D Slice along 0 axis in mir.ndslice ?

jmh530 john.michael.hall at gmail.com
Wed Mar 11 00:24:13 UTC 2020


On Tuesday, 10 March 2020 at 23:31:55 UTC, p.shkadzko wrote:
> [snip]

Below does the same thing as the numpy version.

/+dub.sdl:
dependency "mir-algorithm" version="~>3.7.18"
+/
import mir.ndslice.sorting : sort;
import mir.ndslice.topology : byDim;
import mir.ndslice.slice : sliced;

void main() {
     auto m = [1, -1, 3, 2, 0, -2, 3, 1].sliced(2, 4);
     m.byDim!0.each!(a => a.sort);
}


More information about the Digitalmars-d-learn mailing list