tacet_core/constants.rs
1//! Mathematical constants used throughout the crate.
2
3/// Default deterministic seed for RNG operations.
4///
5/// This seed ensures reproducibility: same seed + same data = same result.
6/// The value `0x74696D696E67` is "timing" encoded in ASCII.
7pub const DEFAULT_SEED: u64 = 0x74696D696E67;
8
9/// Decile percentiles for quantile computation.
10pub const DECILES: [f64; 9] = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
11
12/// Unit vector for uniform shift detection.
13pub const ONES: [f64; 9] = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
14
15/// Centered tail basis vector for tail effect detection.
16/// This is orthogonal to ONES, allowing independent estimation of shift vs tail effects.
17pub const B_TAIL: [f64; 9] = [-0.5, -0.375, -0.25, -0.125, 0.0, 0.125, 0.25, 0.375, 0.5];
18
19/// Natural log of 2*pi, used in multivariate normal log-pdf computation.
20pub const LOG_2PI: f64 = 1.8378770664093453;
21
22// =============================================================================
23// Default configuration constants (spec ยง3.4)
24// =============================================================================
25
26/// Default pass threshold for Bayesian decision: P(leak) < 0.05 means Pass.
27pub const DEFAULT_PASS_THRESHOLD: f64 = 0.05;
28
29/// Default fail threshold for Bayesian decision: P(leak) > 0.95 means Fail.
30pub const DEFAULT_FAIL_THRESHOLD: f64 = 0.95;
31
32/// Default number of bootstrap iterations for covariance estimation.
33pub const DEFAULT_BOOTSTRAP_ITERATIONS: usize = 2000;
34
35/// Default number of calibration samples per class.
36pub const DEFAULT_CALIBRATION_SAMPLES: usize = 5000;
37
38/// Default batch size for adaptive sampling loop.
39pub const DEFAULT_BATCH_SIZE: usize = 1000;
40
41/// Default maximum samples per class before stopping.
42pub const DEFAULT_MAX_SAMPLES: usize = 1_000_000;
43
44/// Default time budget in seconds.
45pub const DEFAULT_TIME_BUDGET_SECS: u64 = 60;