fastest way to sort the entries of a "smooth" 2D array

Posted by Drew Wagner on Stack Overflow See other posts from Stack Overflow or by Drew Wagner
Published on 2010-04-01T00:11:18Z Indexed on 2010/04/01 0:13 UTC
Read the original article Hit count: 542

Filed under:
|

What is the fastest way to sort the values in a smooth 2D array?

The input is a small filtered image:

  • about 60 by 80 pixels
  • single channel
  • single or double precision float
  • row major storage, sequential in memory
  • values have mixed sign
  • piecewise "smooth", with regions on the order of 10 pixels wide

Output is a flat (about 4800 value) array of the sorted values, along with the indices that sort the original array.

© Stack Overflow or respective owner

Related posts about mergesort

Related posts about timsort