fn calculate_statistic_allocating<T: Ord + Clone>(xs: &[T], ys: &[T]) -> Result<f64, TestError> {
    if xs.is_empty() || ys.is_empty() {
        return Err(TestError::SequenceHasFewerThanEightElements);
    }

    let (xs, ys) = {
        let mut xs = xs.to_vec();
        let mut ys = ys.to_vec();

        // xs and ys must be sorted for the stepwise ECDF calculations to work.
        xs.sort();
        ys.sort();
        (xs, ys)
    };
    Ok(calculate_statistic_inner_presorted(&xs, &ys))
}
/// Calculate the test statistic for the two sample Kolmogorov-Smirnov test.
///
/// The test statistic is the maximum vertical distance between the ECDFs of
/// the two samples.
///
/// This function copies each input into a new Vec in order to do sorting.
Calculate the test statistic for the two sample Kolmogorov-Smirnov test.
The test statistic is the maximum vertical distance between the ECDFs of
the two samples.

This function copies each input into a new Vec in order to do sorting.
Calculate the test statistic for the two sample Kolmogorov - Smirnov test . The test statistic is the maximum vertical distance between the ECDFs of the two samples . This function copies each input into a new Vec in order to do sorting .
fn calculate_statistic_allocating<T: Ord + Clone>(xs: &[T], ys: &[T]) -> Result<f64, TestError> {
    if xs.is_empty() || ys.is_empty() {
        return Err(TestError::SequenceHasFewerThanEightElements);
    }
    let (xs, ys) = {
        let mut xs = xs.to_vec();
        let mut ys = ys.to_vec();
        // xs and ys must be sorted for the stepwise ECDF calculations to work.
        xs.sort();
        ys.sort();
        (xs, ys)
    };
    Ok(calculate_statistic_inner_presorted(&xs, &ys))
}
fn calculate_statistic_allocating < T : Ord + Clone > ( xs : & [ T ] , ys : & [ T ] ) -> Result < f64 , TestError > { if xs . is_empty ( ) || ys . is_empty ( ) { return Err ( TestError :: SequenceHasFewerThanEightElements ) ; } let ( xs , ys ) = { let mut xs = xs . to_vec ( ) ; let mut ys = ys . to_vec ( ) ; // xs and ys must be sorted for the stepwise ECDF calculations to work. xs . sort ( ) ; ys . sort ( ) ; ( xs , ys ) } ; Ok ( calculate_statistic_inner_presorted ( & xs , & ys ) ) }
Calculate the test statistic for the two sample Kolmogorov-Smirnov test.
Calculate the test statistic for the two sample Kolmogorov - Smirnov test .
xs
&[T]
ys
&[T]
xs
&[T]
ys
&[T]