sort2d

2D sorting algorithms.

mr_utils.utils.sort2d.sort2d(A)[source]

Sorting algorithm for two-dimensional arrays.

Parameters:A (array_like) – 2d array to be sorted.
Returns:
  • array_like – sorted A
  • array_like – flattened indices giving the sort order.

Notes

Note: if A is complex, you may want to provide abs(A).

Numpy implementation of algorithm from [2].

References

[2]Zhou, M., & Wang, H. (2010, December). An efficient selection sorting algorithm for two-dimensional arrays. In Genetic and Evolutionary Computing (ICGEC), 2010 Fourth International Conference on (pp. 853-855). IEEE.
mr_utils.utils.sort2d.sort2d_loop(A)[source]

An efficient selection sorting algorithm for two-dimensional arrays.

Parameters:A (array_like) – 2d array to be sorted.
Returns:B – Monotonically sorted A (along both axes).
Return type:array_like

Notes

Implementation of algorithm from [1].

References

[1]Zhou, M., & Wang, H. (2010, December). An efficient selection sorting algorithm for two-dimensional arrays. In Genetic and Evolutionary Computing (ICGEC), 2010 Fourth International Conference on (pp. 853-855). IEEE.