kumar_johnson function

Kumar-Johnson distance (lowlevel function)