fdars_core/depth/
random_projection.rs1use crate::matrix::FdMatrix;
4
5use super::random_depth_core;
6
7#[must_use = "expensive computation whose result should not be discarded"]
17pub fn random_projection_1d(data_obj: &FdMatrix, data_ori: &FdMatrix, nproj: usize) -> Vec<f64> {
18 random_projection_1d_seeded(data_obj, data_ori, nproj, None)
19}
20
21#[must_use = "expensive computation whose result should not be discarded"]
23pub fn random_projection_1d_seeded(
24 data_obj: &FdMatrix,
25 data_ori: &FdMatrix,
26 nproj: usize,
27 seed: Option<u64>,
28) -> Vec<f64> {
29 random_depth_core(
30 data_obj,
31 data_ori,
32 nproj,
33 seed,
34 0.0,
35 |acc, d| acc + d,
36 |acc, n| acc / n as f64,
37 )
38}
39
40#[must_use = "expensive computation whose result should not be discarded"]
42pub fn random_projection_2d(data_obj: &FdMatrix, data_ori: &FdMatrix, nproj: usize) -> Vec<f64> {
43 random_projection_1d(data_obj, data_ori, nproj)
44}