1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! This module contains various mathematical functions and utilities.
////////////
// Consts //
////////////
/// The default oversampling for randomised SVD
pub const DEFAULT_OVERSAMPLING_RAND_SVD: usize = 10;
/// Oversampling for randomised SVD on single-cell data.
///
/// Paired with [N_POWER_ITERS_SINGLE_CELL]. Single-cell embeddings have a
/// slowly decaying spectrum below the first few components, so the sketch
/// has to separate components whose singular values are close.
///
/// Clamp it against the rank of the input before use: on a small matrix
/// `no_pcs + 20` can exceed `min(rows, cols)`.
pub const MAX_OVERSAMPLING_SINGLE_CELL: usize = 20;
/// Power iterations for randomised SVD on single-cell data.
pub const N_POWER_ITERS_SINGLE_CELL: usize = 4;
/// The default power iterations for randomised SVD
pub const DEFAULT_N_POWER_ITERS_RAND_SVD: usize = 2;
/// MAD scaling constant. R's `mad()` applies this factor by default.
pub const MAD_SCALE: f64 = 1.482_602_218_505_602;