pub struct SobolG { /* private fields */ }Expand description
Sobol’s g function, y = Πᵢ gᵢ(xᵢ) with gᵢ = (|4xᵢ − 2| + aᵢ)/(1 + aᵢ), each xᵢ uniform
on [0, 1].
Each gᵢ has mean 1 and variance Vᵢ = 1/(3 (1 + aᵢ)²), so (A. Saltelli and others, 2010,
the module super::sobol’s reference, Appendix A, p. 268, eqs. (31) and (32))
V = Πᵢ (1 + Vᵢ) − 1, computed asexp(Σᵢ ln(1 + Vᵢ)) − 1withln_1pandexp_m1, so that a largeaᵢ(a tinyVᵢ) isn’t lost in the1 +,Sᵢ = Vᵢ/V, andS_Tᵢ = Vᵢ Πⱼ≠ᵢ (1 + Vⱼ) / V.
Implementations§
Source§impl SobolG
impl SobolG
Sourcepub const MAX_A: f64 = 1e100
pub const MAX_A: f64 = 1e100
The largest aᵢ: 3 (1 + aᵢ)² overflows past about 7.7e153, and at 1e100 a factor’s
share is already 1e-200 of the next one’s.
Sourcepub fn new(a: Vec<f64>) -> Result<Self, AnalysisError>
pub fn new(a: Vec<f64>) -> Result<Self, AnalysisError>
The function with one factor for each of a.
§Errors
AnalysisError::TooFewfor an emptya.AnalysisError::Domainfor anaᵢthat isn’t between 0 andSobolG::MAX_A.
Sourcepub fn factors(&self) -> Result<Vec<Factor>, AnalysisError>
pub fn factors(&self) -> Result<Vec<Factor>, AnalysisError>
Its factors, x1 to xk, each on [0, 1].
§Errors
None in practice; Factor::new’s, as the type requires.
Sourcepub fn evaluate(&self, x: &[f64]) -> f64
pub fn evaluate(&self, x: &[f64]) -> f64
y at x; NaN for a slice whose length isn’t the number of factors.
Sourcepub fn first_order(&self) -> Vec<f64>
pub fn first_order(&self) -> Vec<f64>
The first-order indices, Sᵢ = Vᵢ/V.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SobolG
impl<'de> Deserialize<'de> for SobolG
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for SobolG
Auto Trait Implementations§
impl Freeze for SobolG
impl RefUnwindSafe for SobolG
impl Send for SobolG
impl Sync for SobolG
impl Unpin for SobolG
impl UnsafeUnpin for SobolG
impl UnwindSafe for SobolG
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more