Skip to main content

fdars_core/depth/
random_tukey.rs

1//! Random Tukey depth measures.
2
3use crate::matrix::FdMatrix;
4
5use super::random_depth_core;
6
7/// Compute random Tukey depth for 1D functional data.
8///
9/// Takes the minimum over all random projections (more conservative than RP depth).
10#[must_use = "expensive computation whose result should not be discarded"]
11pub fn random_tukey_1d(data_obj: &FdMatrix, data_ori: &FdMatrix, nproj: usize) -> Vec<f64> {
12    random_tukey_1d_seeded(data_obj, data_ori, nproj, None)
13}
14
15/// Compute random Tukey depth with optional seed for reproducibility.
16#[must_use = "expensive computation whose result should not be discarded"]
17pub fn random_tukey_1d_seeded(
18    data_obj: &FdMatrix,
19    data_ori: &FdMatrix,
20    nproj: usize,
21    seed: Option<u64>,
22) -> Vec<f64> {
23    random_depth_core(
24        data_obj,
25        data_ori,
26        nproj,
27        seed,
28        f64::INFINITY,
29        f64::min,
30        |acc, _| acc,
31    )
32}
33
34/// Compute random Tukey depth for 2D functional data.
35#[must_use = "expensive computation whose result should not be discarded"]
36pub fn random_tukey_2d(data_obj: &FdMatrix, data_ori: &FdMatrix, nproj: usize) -> Vec<f64> {
37    random_tukey_1d(data_obj, data_ori, nproj)
38}