slightly faster version of fastMedian()
Merge branch 'master' into sparse