pub struct Wishart {
pub df: f64,
pub scale: Vec<Vec<f64>>,
/* private fields */
}Expand description
The Wishart distribution of X = Σ_k z_k z_kᵀ, z_k ~ N(0, S), with ν > p − 1 degrees of
freedom (SciPy’s wishart(df, scale)): log f(X) = ((ν − p − 1)/2) log|X| − tr(S⁻¹X)/2 − (νp/2) log 2 − (ν/2) log|S| − log Γ_p(ν/2). Sampling uses Bartlett’s decomposition
X = L A Aᵀ Lᵀ, A lower triangular with A_ii = √χ²_{ν−i} and standard normal entries
below the diagonal.
Fields§
§df: f64§scale: Vec<Vec<f64>>Implementations§
Source§impl Wishart
impl Wishart
pub fn new(df: f64, scale: Vec<Vec<f64>>) -> Result<Self, ErrorsJSL>
pub fn logpdf(&self, x: &Vec<Vec<f64>>) -> Result<f64, ErrorsJSL>
pub fn pdf(&self, x: &Vec<Vec<f64>>) -> Result<f64, ErrorsJSL>
Sourcepub fn entropy(&self) -> f64
pub fn entropy(&self) -> f64
((p + 1)/2) log|S| + (p(p + 1)/2) log 2 + log Γ_p(ν/2) − ((ν − p − 1)/2) ψ_p(ν/2) + νp/2.
pub fn sample<U: UniformGenerator>(&self, rng: &mut U) -> Vec<Vec<f64>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Wishart
impl RefUnwindSafe for Wishart
impl Send for Wishart
impl Sync for Wishart
impl Unpin for Wishart
impl UnsafeUnpin for Wishart
impl UnwindSafe for Wishart
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more