nmatrix
nmatrix copied to clipboard
#sort and #sort! along specified dimension
NMatrix is primarily meant to be a static non-mutable storage for data, but with many plugins coming up that contain statistics methods that require sorted data, I think it is important to have our own implementations of destructive and non-destructive sorting.
It would be best if standard library functions are used for the implementation.
Both methods should be able accept the dimension along which the sorting is to be performed.
Can you give more details on how the sorting needs to be done? Like for a 2D matrix should it sort along the row or column according to the dimension specified?
Check out the numpy.sort() function as a reference.
Okay so the operations can be: => A specified row or column can be sorted. => All the rows or all the columns can be sorted. => Whole matrix can be sorted, treated as an array.
AFAIK it can extend to more than 2 dimensions and not just rows and columns.