Skip to main content

free_probability/
lib.rs

1//! Free Probability for Rust.
2//!
3//! A port of [free-probability-c](https://github.com/SuperInstance/free-probability-c)
4//! with corrections and enhancements.
5//!
6//! ## Why free probability?
7//!
8//! Xavier initialization. He initialization. Kaiming initialization.
9//! They match Marchenko-Pastur. Free probability explains why.
10//!
11//! ## Modules
12//!
13//! - [`moments`] — Empirical moment computation, moment↔cumulant transforms
14//! - [`r_transform`] — R-transform (free additive convolution)
15//! - [`s_transform`] — S-transform (free multiplicative convolution)
16//! - [`marchenko_pastur`] — Marchenko–Pastur density and moments
17//! - [`prediction`] — Layer-combination prediction and gradient analysis
18
19pub mod moments;
20pub mod r_transform;
21pub mod s_transform;
22pub mod marchenko_pastur;
23pub mod prediction;
24
25/// Maximum supported moment/cumulant order.
26pub const FP_MAX_ORDER: usize = 64;
27
28/// An empirical distribution sampled at discrete points.
29#[derive(Debug, Clone)]
30pub struct EmpiricalDist<'a> {
31    pub support_min: f64,
32    pub support_max: f64,
33    pub points: &'a [f64],
34}