Skip to content

Sort function for matrices and vectors returning indices as well

Submitted by Thomas

Assigned to Nobody

Link to original bugzilla bug (#299)

Description

It would be extremely useful if Eigen supports sorting a matrix.
Ideally (at least for me), it would have similar functionality as Matlab's sort function:

[SortVal,SortInx] = sort(A, 2, 'descend')
-Input matrix "A"
-Matrix sort direction (rowwise/columnwise)
-Sort ordering (descend/ascend)

And returning:

  • SortVal is the sorted version of matrix A
  • SortInx are the corresponding indices.
Edited by Antonio Sánchez