wave_hedges function

Wave hedges distance (lowlevel function)