How to sort a multidimensional ndslice?
James Blachly
james.blachly at gmail.com
Tue Aug 18 19:50:20 UTC 2020
On Tuesday, 18 August 2020 at 13:07:56 UTC, Arredondo wrote:
> On Tuesday, 18 August 2020 at 04:07:56 UTC, 9il wrote:
>> To reorder the columns data according to precomputed index:
>> auto index = a.byDim!1.map!sum.slice;
>
> Hello Ilya, thanks for the answer!
>
> Unfortunately I can't use it because I don't have (and can't
> define) a sorting index for my columns. I only have a predicate
> `larger(c1, c2)` that compares two columns to decide which one
> is "larger".
>
> Cheers!
> Armando.
Armando, I believe you can just pass your predicate to the sort!
template
http://docs.algorithm.dlang.io/latest/mir_ndslice_sorting.html
More information about the Digitalmars-d-learn
mailing list