nmatrix icon indicating copy to clipboard operation
nmatrix copied to clipboard

#sort and #sort! along specified dimension

Open v0dro opened this issue 9 years ago • 4 comments

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.

v0dro avatar Feb 02 '16 11:02 v0dro

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?

shahsaurabh0605 avatar Feb 15 '16 10:02 shahsaurabh0605

Check out the numpy.sort() function as a reference.

v0dro avatar Feb 15 '16 13:02 v0dro

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.

shahsaurabh0605 avatar Feb 15 '16 13:02 shahsaurabh0605

AFAIK it can extend to more than 2 dimensions and not just rows and columns.

v0dro avatar Feb 15 '16 13:02 v0dro