pub struct Lattice<A, P = ()>where
A: Axis,{ /* private fields */ }Expand description
A non-empty, strictly ascending sequence of finite f64 anchors,
each paired with a payload P, tagged with its Axis.
Storage is a single Box<[(f64, P)]> — co-indexing of scalars and
payloads is structural, not an unwritten invariant.
P defaults to () for the no-payload case; Lattice<A> and
Lattice<A, ()> are the same type. Construct via FromIterator:
pairs.into_iter().collect::<Lattice<A, P>>() for the payload case
or xs.into_iter().collect::<Lattice<A>>() for the unit case.
Implementations§
Source§impl<A, P> Lattice<A, P>where
A: Axis,
impl<A, P> Lattice<A, P>where
A: Axis,
Source§impl<A, P> Lattice<A, P>where
A: Axis,
impl<A, P> Lattice<A, P>where
A: Axis,
pub fn snap(&self, observed: Scalar<A>) -> Anchor
Sourcepub fn pharmonic(&self, bracket: Bracket, observed: Scalar<A>) -> f64
pub fn pharmonic(&self, bracket: Bracket, observed: Scalar<A>) -> f64
Pseudo-harmonic conditional probability of the lower anchor for
observation x bracketed by (lo, hi). Encodes the
Ganzfried-Sandholm 2013 formula p = (B-x)(1+A) / (B-A)(1+x).
The (1+x) term assumes the axis is non-negative — see Axis.
The lo != hi precondition is asserted; callers must check
Bracket::is_clamped first.
pub fn harmonic<R>(&self, observed: Scalar<A>, rng: &mut R) -> Anchor
pub fn phargmax(&self, observed: Scalar<A>) -> Anchor
Trait Implementations§
Auto Trait Implementations§
impl<A, P> Freeze for Lattice<A, P>
impl<A, P> RefUnwindSafe for Lattice<A, P>where
A: RefUnwindSafe,
P: RefUnwindSafe,
impl<A, P> Send for Lattice<A, P>
impl<A, P> Sync for Lattice<A, P>
impl<A, P> Unpin for Lattice<A, P>where
A: Unpin,
impl<A, P> UnsafeUnpin for Lattice<A, P>
impl<A, P> UnwindSafe for Lattice<A, P>where
A: UnwindSafe,
P: UnwindSafe,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request