StaticArrays.jl icon indicating copy to clipboard operation
StaticArrays.jl copied to clipboard

implement Statistics.median

Open stev47 opened this issue 3 years ago • 0 comments

This implements Statistics.median based on the existing bitonic sorting, avoiding unnecessary allocation. While it is generally suboptimal to sort the whole array, the compiler manages to skip some branches since only the middle element(s) are used. Thus median is generally faster than sort.

Using a dedicated median selection network could yield better performance and might be considered for future improvement.

stev47 avatar Nov 29 '21 00:11 stev47