Kolmogorov-Smirnov statistic from two samples
Adapted from Press, Teukolsky, Vetterling and Flannery, Numerical Recipes in Fortran p619.