diff options
Diffstat (limited to 'vendor/criterion/src/stats/bivariate')
-rw-r--r--[-rwxr-xr-x] | vendor/criterion/src/stats/bivariate/bootstrap.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/criterion/src/stats/bivariate/mod.rs | 53 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/criterion/src/stats/bivariate/regression.rs | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vendor/criterion/src/stats/bivariate/resamples.rs | 0 |
4 files changed, 34 insertions, 19 deletions
diff --git a/vendor/criterion/src/stats/bivariate/bootstrap.rs b/vendor/criterion/src/stats/bivariate/bootstrap.rs index 9eb7fa7b5..9eb7fa7b5 100755..100644 --- a/vendor/criterion/src/stats/bivariate/bootstrap.rs +++ b/vendor/criterion/src/stats/bivariate/bootstrap.rs diff --git a/vendor/criterion/src/stats/bivariate/mod.rs b/vendor/criterion/src/stats/bivariate/mod.rs index d1e8df703..2351c9ef6 100755..100644 --- a/vendor/criterion/src/stats/bivariate/mod.rs +++ b/vendor/criterion/src/stats/bivariate/mod.rs @@ -8,6 +8,7 @@ use crate::stats::bivariate::resamples::Resamples; use crate::stats::float::Float; use crate::stats::tuple::{Tuple, TupledDistributionsBuilder}; use crate::stats::univariate::Sample; +#[cfg(feature = "rayon")] use rayon::iter::{IntoParallelIterator, ParallelIterator}; /// Bivariate `(X, Y)` data @@ -72,27 +73,41 @@ where T::Distributions: Send, T::Builder: Send, { - (0..nresamples) - .into_par_iter() - .map_init( - || Resamples::new(*self), - |resamples, _| statistic(resamples.next()), - ) - .fold( - || T::Builder::new(0), - |mut sub_distributions, sample| { + #[cfg(feature = "rayon")] + { + (0..nresamples) + .into_par_iter() + .map_init( + || Resamples::new(*self), + |resamples, _| statistic(resamples.next()), + ) + .fold( + || T::Builder::new(0), + |mut sub_distributions, sample| { + sub_distributions.push(sample); + sub_distributions + }, + ) + .reduce( + || T::Builder::new(0), + |mut a, mut b| { + a.extend(&mut b); + a + }, + ) + .complete() + } + #[cfg(not(feature = "rayon"))] + { + let mut resamples = Resamples::new(*self); + (0..nresamples) + .map(|_| statistic(resamples.next())) + .fold(T::Builder::new(0), |mut sub_distributions, sample| { sub_distributions.push(sample); sub_distributions - }, - ) - .reduce( - || T::Builder::new(0), - |mut a, mut b| { - a.extend(&mut b); - a - }, - ) - .complete() + }) + .complete() + } } /// Returns a view into the `X` data diff --git a/vendor/criterion/src/stats/bivariate/regression.rs b/vendor/criterion/src/stats/bivariate/regression.rs index f09443f10..f09443f10 100755..100644 --- a/vendor/criterion/src/stats/bivariate/regression.rs +++ b/vendor/criterion/src/stats/bivariate/regression.rs diff --git a/vendor/criterion/src/stats/bivariate/resamples.rs b/vendor/criterion/src/stats/bivariate/resamples.rs index e254dc792..e254dc792 100755..100644 --- a/vendor/criterion/src/stats/bivariate/resamples.rs +++ b/vendor/criterion/src/stats/bivariate/resamples.rs |