Struct nyx_space::mc::MultivariateNormal
source · pub struct MultivariateNormal<S: State>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <<S::Size as DimMin<S::Size>>::Output as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output, S::Size> + Allocator<f64, <S::Size as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimSub<Const<1>>>::Output>,
<DefaultAllocator as Allocator<f64, S::VecLength>>::Buffer: Send,
S::Size: DimMin<S::Size> + DimSub<Const<1>>,
<S::Size as DimMin<S::Size>>::Output: DimSub<Const<1>>,{
pub template: S,
pub params: Vec<StateParameter>,
pub mean: OVector<f64, DimMinimum<S::Size, S::Size>>,
pub sqrt_s_v: OMatrix<f64, S::Size, DimMinimum<S::Size, S::Size>>,
pub std_norm_distr: Normal<f64>,
}
Expand description
A state generator for Monte Carlo analyses.
Fields§
§template: S
The template state
params: Vec<StateParameter>
The ordered vector of parameters to which the mean and covariance correspond to.
mean: OVector<f64, DimMinimum<S::Size, S::Size>>
The mean of the multivariate normal distribution
sqrt_s_v: OMatrix<f64, S::Size, DimMinimum<S::Size, S::Size>>
The dot product \sqrt{\vec s} \cdot \vec v, where S is the singular values and V the V matrix from the SVD decomp of the covariance of multivariate normal distribution
std_norm_distr: Normal<f64>
The standard normal distribution used to seed the multivariate normal distribution
Implementations§
source§impl<S: State> MultivariateNormal<S>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <<S::Size as DimMin<S::Size>>::Output as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output, S::Size> + Allocator<f64, <S::Size as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimSub<Const<1>>>::Output>,
<DefaultAllocator as Allocator<f64, S::VecLength>>::Buffer: Send,
S::Size: DimMin<S::Size> + DimSub<Const<1>>,
<S::Size as DimMin<S::Size>>::Output: DimSub<Const<1>>,
impl<S: State> MultivariateNormal<S>where DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <<S::Size as DimMin<S::Size>>::Output as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output, S::Size> + Allocator<f64, <S::Size as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimSub<Const<1>>>::Output>, <DefaultAllocator as Allocator<f64, S::VecLength>>::Buffer: Send, S::Size: DimMin<S::Size> + DimSub<Const<1>>, <S::Size as DimMin<S::Size>>::Output: DimSub<Const<1>>,
sourcepub fn new(
template: S,
params: Vec<StateParameter>,
mean: OVector<f64, DimMinimum<S::Size, S::Size>>,
cov: OMatrix<f64, S::Size, S::Size>
) -> Result<Self, NyxError>
pub fn new( template: S, params: Vec<StateParameter>, mean: OVector<f64, DimMinimum<S::Size, S::Size>>, cov: OMatrix<f64, S::Size, S::Size> ) -> Result<Self, NyxError>
Creates a new Monte Carlos state generator from a mean and covariance which must be of the same size as the state vector The covariance must be positive semi definite. The algorithm is the one from numpy https://github.com/numpy/numpy/blob/6c16f23c30fe490422959d30c2e22345211a2fe3/numpy/random/mtrand.pyx#L3979
Trait Implementations§
source§impl<S: State> Distribution<DispersedState<S>> for MultivariateNormal<S>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <<S::Size as DimMin<S::Size>>::Output as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output, S::Size> + Allocator<f64, <S::Size as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimSub<Const<1>>>::Output>,
<DefaultAllocator as Allocator<f64, S::VecLength>>::Buffer: Send,
S::Size: DimMin<S::Size> + DimSub<Const<1>>,
<S::Size as DimMin<S::Size>>::Output: DimSub<Const<1>> + DimName,
impl<S: State> Distribution<DispersedState<S>> for MultivariateNormal<S>where DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <<S::Size as DimMin<S::Size>>::Output as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimMin<S::Size>>::Output> + Allocator<f64, <S::Size as DimMin<S::Size>>::Output, S::Size> + Allocator<f64, <S::Size as DimSub<Const<1>>>::Output> + Allocator<f64, S::Size, <S::Size as DimSub<Const<1>>>::Output>, <DefaultAllocator as Allocator<f64, S::VecLength>>::Buffer: Send, S::Size: DimMin<S::Size> + DimSub<Const<1>>, <S::Size as DimMin<S::Size>>::Output: DimSub<Const<1>> + DimName,
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> DispersedState<S>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> DispersedState<S>
Generate a random value of
T
, using rng
as the source of randomness.Auto Trait Implementations§
impl<S> !RefUnwindSafe for MultivariateNormal<S>
impl<S> !Send for MultivariateNormal<S>
impl<S> !Sync for MultivariateNormal<S>
impl<S> !Unpin for MultivariateNormal<S>
impl<S> !UnwindSafe for MultivariateNormal<S>
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.