pub struct SignedMeasure {
pub positive_density: Box<dyn Fn(&[f64]) -> f64>,
pub negative_density: Box<dyn Fn(&[f64]) -> f64>,
pub domain: MeasurableSet,
pub n_samples: usize,
}Expand description
A signed measure represented as a difference of two non-negative measures.
By the Jordan decomposition theorem, every signed measure ν can be
written as ν = ν⁺ − ν⁻ where ν⁺, ν⁻ ≥ 0 are mutually singular.
Here we work numerically with density functions.
Fields§
§positive_density: Box<dyn Fn(&[f64]) -> f64>The positive part density f⁺(x) ≥ 0.
negative_density: Box<dyn Fn(&[f64]) -> f64>The negative part density f⁻(x) ≥ 0.
domain: MeasurableSetDomain of integration.
n_samples: usizeNumber of Monte Carlo samples.
Implementations§
Source§impl SignedMeasure
impl SignedMeasure
Sourcepub fn new(
positive_density: impl Fn(&[f64]) -> f64 + 'static,
negative_density: impl Fn(&[f64]) -> f64 + 'static,
domain: MeasurableSet,
n_samples: usize,
) -> Self
pub fn new( positive_density: impl Fn(&[f64]) -> f64 + 'static, negative_density: impl Fn(&[f64]) -> f64 + 'static, domain: MeasurableSet, n_samples: usize, ) -> Self
Create a signed measure from positive and negative densities.
Sourcepub fn from_density(
density: impl Fn(&[f64]) -> f64 + 'static,
domain: MeasurableSet,
n_samples: usize,
) -> Self
pub fn from_density( density: impl Fn(&[f64]) -> f64 + 'static, domain: MeasurableSet, n_samples: usize, ) -> Self
Create a signed measure from a single (possibly negative) density f.
Sourcepub fn evaluate(&self, set: &MeasurableSet) -> f64
pub fn evaluate(&self, set: &MeasurableSet) -> f64
Evaluate the signed measure on a set: ν(A) = ∫_A (f⁺ − f⁻) dx.
Sourcepub fn total_variation(&self, set: &MeasurableSet) -> f64
pub fn total_variation(&self, set: &MeasurableSet) -> f64
Total variation: |ν|(A) = ∫_A (f⁺ + f⁻) dx.
Sourcepub fn hahn_positive_set_samples(&self, n: usize) -> Vec<Vec<f64>>
pub fn hahn_positive_set_samples(&self, n: usize) -> Vec<Vec<f64>>
Hahn decomposition: identify the positive set P where f⁺ > f⁻.
Returns a sample of points in P within the domain.
Sourcepub fn jordan_decomposition(&self) -> (f64, f64)
pub fn jordan_decomposition(&self) -> (f64, f64)
Jordan decomposition: return estimates of ν⁺(domain) and ν⁻(domain).
Auto Trait Implementations§
impl Freeze for SignedMeasure
impl !RefUnwindSafe for SignedMeasure
impl !Send for SignedMeasure
impl !Sync for SignedMeasure
impl Unpin for SignedMeasure
impl UnsafeUnpin for SignedMeasure
impl !UnwindSafe for SignedMeasure
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.