Skip to main content

SobolG

Struct SobolG 

Source
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 as exp(Σᵢ ln(1 + Vᵢ)) − 1 with ln_1p and exp_m1, so that a large aᵢ (a tiny Vᵢ) isn’t lost in the 1 +,
  • Sᵢ = Vᵢ/V, and
  • S_Tᵢ = Vᵢ Πⱼ≠ᵢ (1 + Vⱼ) / V.

Implementations§

Source§

impl SobolG

Source

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.

Source

pub fn new(a: Vec<f64>) -> Result<Self, AnalysisError>

The function with one factor for each of a.

§Errors
Source

pub fn a(&self) -> &[f64]

The aᵢ.

Source

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.

Source

pub fn evaluate(&self, x: &[f64]) -> f64

y at x; NaN for a slice whose length isn’t the number of factors.

Source

pub fn mean(&self) -> f64

Its mean, 1.

Source

pub fn variance(&self) -> f64

Its variance, V = Πᵢ (1 + Vᵢ) − 1.

Source

pub fn first_order(&self) -> Vec<f64>

The first-order indices, Sᵢ = Vᵢ/V.

Source

pub fn total(&self) -> Vec<f64>

The total indices, S_Tᵢ = Vᵢ Πⱼ≠ᵢ (1 + Vⱼ) / V.

Trait Implementations§

Source§

impl Clone for SobolG

Source§

fn clone(&self) -> SobolG

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SobolG

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SobolG

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SobolG

Source§

fn eq(&self, other: &SobolG) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SobolG

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SobolG

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.