pub enum Prior<const D: usize> {
Uniform {
bounds: [(f64, f64); D],
},
Gaussian {
mean: [f64; D],
cov_diag: [f64; D],
truncation_sigmas: f64,
},
Custom {
bounds: [(f64, f64); D],
density: Arc<dyn Fn([f64; D]) -> f64 + Send + Sync>,
},
}Expand description
Probability density / sampling region over R^D.
All variants are validated by Prior::validate. The sample-space
described here is the support of the prior; quadrature points are drawn
inside this support and transformed if needed.
Variants§
Uniform
Uniform density on the axis-aligned box bounds[i] = (lo, hi).
Fields
Gaussian
Axis-aligned Gaussian. cov_diag[i] holds σ² along axis i.
Truncated to ±k·σ in Quadrature::Sobol / Quadrature::LatinHypercube
via inverse-CDF; the truncation_sigmas field controls k (default 4.0).
Fields
Custom
Arbitrary density specified pointwise. The closure must return a
non-negative density. Quadrature for Custom priors is restricted to
Sobol / LatinHypercube over an axis-aligned bounding box that the
caller supplies (the closure is not used by quadrature; only by
importance-weighting inside evaluate_area_loss).
Implementations§
Source§impl<const D: usize> Prior<D>
impl<const D: usize> Prior<D>
Sourcepub fn validate(&self) -> Result<(), AreaError>
pub fn validate(&self) -> Result<(), AreaError>
Reject malformed priors before any quadrature samples are drawn.
Sourcepub fn bounding_box(&self) -> [(f64, f64); D]
pub fn bounding_box(&self) -> [(f64, f64); D]
Axis-aligned bounding box used as the search space for [Quadrature::WorstCaseSearch]
and the integration domain for tensor-product / sampled quadratures.
Trait Implementations§
Auto Trait Implementations§
impl<const D: usize> Freeze for Prior<D>
impl<const D: usize> !RefUnwindSafe for Prior<D>
impl<const D: usize> Send for Prior<D>
impl<const D: usize> Sync for Prior<D>
impl<const D: usize> Unpin for Prior<D>
impl<const D: usize> UnsafeUnpin for Prior<D>
impl<const D: usize> !UnwindSafe for Prior<D>
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for 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.