Skip to main content

salib_core/
lib.rs

1//! `salib-core` — foundational types for the salib sensitivity-analysis
2//! library.
3//!
4//! Owns the experiment-level vocabulary that every other salib crate
5//! composes against: [`Problem`], [`Factor`], the closed [`Distribution`]
6//! enum, [`rng::RngState`] (multi-stream ChaCha20 with deterministic
7//! salt-derived forking), and the [`reduce`] primitives
8//! ([`reduce::tree_sum`], [`reduce::tree_dot`], [`reduce::tree_var`] and
9//! their `par_` variants).
10//!
11//! Same architectural family as Python's `SALib`, R's `sensitivity`, and
12//! MATLAB's `UQLab`.
13//!
14//! # Determinism
15//!
16//! `salib-core` is the determinism floor every sampler and estimator
17//! stands on:
18//!
19//! - [`rng::RngState`] is a serializable RNG identity. Recording it
20//!   lets a verifier reconstruct any SA campaign's RNG stream.
21//! - [`reduce`] reductions defeat the float-associativity
22//!   nondeterminism that naive `par_iter().sum()` over `f64` produces
23//!   under rayon. Bit-identical regardless of thread count.
24
25#![forbid(unsafe_code)]
26#![deny(clippy::disallowed_methods)]
27#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
28
29pub mod distribution;
30pub mod problem;
31pub mod reduce;
32pub mod rng;
33
34pub use distribution::Distribution;
35pub use problem::{BuildError, Factor, FactorKind, Group, Problem, ProblemBuilder};
36pub use reduce::{par_tree_dot, par_tree_sum, par_tree_var, tree_dot, tree_sum, tree_var, BLOCK};
37pub use rng::{RngAlgorithm, RngState};