pub struct Generator<S: State, Distr: Distribution<f64> + Copy>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,{
pub template: S,
pub dispersions: Vec<Dispersion<Distr>>,
}
Expand description
A state generator for Monte Carlo analyses.
Fields§
§template: S
The template state
dispersions: Vec<Dispersion<Distr>>
The list of dispersions to be added to the template state Note that we can’t use a HashMap here because StateParameter has a SlantAngle option comprised of f64s, and those neither have Hash nor Eq
Implementations§
source§impl<S: State, D: Distribution<f64> + Copy> Generator<S, D>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,
impl<S: State, D: Distribution<f64> + Copy> Generator<S, D>where DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,
sourcepub fn add_dispersion(
&mut self,
dispersion: Dispersion<D>
) -> Result<(), NyxError>
pub fn add_dispersion( &mut self, dispersion: Dispersion<D> ) -> Result<(), NyxError>
Add a parameter dispersion to this Monte Carlo state generator.
sourcepub fn from_dispersions(
template: S,
dispersions: &[Dispersion<D>]
) -> Result<Self, NyxError>
pub fn from_dispersions( template: S, dispersions: &[Dispersion<D>] ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameters to disperse, and their respective dispersion probability density functions.
sourcepub fn from_dispersion(
template: S,
dispersion: Dispersion<D>
) -> Result<Self, NyxError>
pub fn from_dispersion( template: S, dispersion: Dispersion<D> ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameters to disperse, and their respective dispersion probability density functions.
source§impl<S: State> Generator<S, Normal<f64>>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,
impl<S: State> Generator<S, Normal<f64>>where DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,
sourcepub fn add_3std_dev(
&mut self,
param: StateParameter,
three_sigma: f64
) -> Result<(), NyxError>
pub fn add_3std_dev( &mut self, param: StateParameter, three_sigma: f64 ) -> Result<(), NyxError>
Add a state dispersion from the provided 3-sigma value, zero mean
sourcepub fn add_std_dev(
&mut self,
param: StateParameter,
std_dev: f64
) -> Result<(), NyxError>
pub fn add_std_dev( &mut self, param: StateParameter, std_dev: f64 ) -> Result<(), NyxError>
Add a state dispersion from the provided 1-sigma value, zero mean
sourcepub fn from_3std_devs(
template: S,
three_sigmas: &[(StateParameter, f64)]
) -> Result<Self, NyxError>
pub fn from_3std_devs( template: S, three_sigmas: &[(StateParameter, f64)] ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameters to disperse, and their respective 3-σ standard deviations, zero mean.
sourcepub fn from_3std_dev(
template: S,
param: StateParameter,
three_sigma: f64
) -> Result<Self, NyxError>
pub fn from_3std_dev( template: S, param: StateParameter, three_sigma: f64 ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameter to disperse, and its 3-σ standard deviation, zero mean.
sourcepub fn from_3std_dev_prct(
template: S,
param: StateParameter,
prct: f64
) -> Result<Self, NyxError>
pub fn from_3std_dev_prct( template: S, param: StateParameter, prct: f64 ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameter to disperse, and its 3-σ standard deviation in percentage of the template’s value, zero mean.
sourcepub fn from_3std_dev_prcts(
template: S,
prcts: &[(StateParameter, f64)]
) -> Result<Self, NyxError>
pub fn from_3std_dev_prcts( template: S, prcts: &[(StateParameter, f64)] ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameter to disperse, and its 3-σ standard deviation in percentage of the template’s value, zero mean.
sourcepub fn from_std_devs(
template: S,
std_devs: &[(StateParameter, f64)]
) -> Result<Self, NyxError>
pub fn from_std_devs( template: S, std_devs: &[(StateParameter, f64)] ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameters to disperse, and their respective 1-σ standard deviations, zero mean.
sourcepub fn from_std_dev_prcts(
template: S,
prcts: &[(StateParameter, f64)]
) -> Result<Self, NyxError>
pub fn from_std_dev_prcts( template: S, prcts: &[(StateParameter, f64)] ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameter to disperse, and its 1-σ standard deviation in percentage of the template’s value, zero mean.
sourcepub fn from_std_dev(
template: S,
param: StateParameter,
std_dev: f64
) -> Result<Self, NyxError>
pub fn from_std_dev( template: S, param: StateParameter, std_dev: f64 ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameter to disperse, and its 1-σ standard deviation, zero mean.
sourcepub fn from_std_dev_prct(
template: S,
param: StateParameter,
prct: f64
) -> Result<Self, NyxError>
pub fn from_std_dev_prct( template: S, param: StateParameter, prct: f64 ) -> Result<Self, NyxError>
Create a new Monte Carlo state generator given a template state, the parameter to disperse, and its 1-σ standard deviation in percentage of the template’s value, zero mean.
Trait Implementations§
source§impl<S: State, D: Distribution<f64> + Copy> Distribution<DispersedState<S>> for Generator<S, D>where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,
impl<S: State, D: Distribution<f64> + Copy> Distribution<DispersedState<S>> for Generator<S, D>where DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<usize, S::Size, S::Size> + Allocator<f64, S::VecLength>,
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> DispersedState<S>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> DispersedState<S>
T
, using rng
as the source of randomness.Auto Trait Implementations§
impl<S, Distr> RefUnwindSafe for Generator<S, Distr>where Distr: RefUnwindSafe, S: RefUnwindSafe,
impl<S, Distr> Send for Generator<S, Distr>where Distr: Send,
impl<S, Distr> Sync for Generator<S, Distr>where Distr: Sync,
impl<S, Distr> Unpin for Generator<S, Distr>where Distr: Unpin, S: Unpin,
impl<S, Distr> UnwindSafe for Generator<S, Distr>where Distr: UnwindSafe, S: UnwindSafe,
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>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.