pub struct VmpMessage {
pub natural_params: Vec<f64>,
pub from: String,
pub to: String,
pub direction: MessageDirection,
}Expand description
A VMP message.
The natural_params vector has the dimensionality of the receiving
variable’s exponential family in the factor→variable direction and the
dimensionality of the sender’s sufficient statistics in the opposite
direction. The engine is responsible for maintaining this invariant.
Fields§
§natural_params: Vec<f64>Natural-parameter vector η (or its analogue for variable→factor messages, which carry expected sufficient statistics).
from: StringSender identifier (factor id or variable name).
to: StringReceiver identifier.
direction: MessageDirectionDirection (factor→variable or variable→factor).
Implementations§
Source§impl VmpMessage
impl VmpMessage
Sourcepub fn zeros(
from: String,
to: String,
direction: MessageDirection,
dim: usize,
) -> Self
pub fn zeros( from: String, to: String, direction: MessageDirection, dim: usize, ) -> Self
Zero-message in the given direction and dimensionality.
Sourcepub fn product(a: &Self, b: &Self) -> Result<Self>
pub fn product(a: &Self, b: &Self) -> Result<Self>
Sum two messages element-wise, producing a third (natural parameters add under the product-of-densities rule).
Requires identical direction / endpoints / dimensionality — otherwise returns a dimension-mismatch error.
Sourcepub fn accumulate(&mut self, rhs: &Self) -> Result<()>
pub fn accumulate(&mut self, rhs: &Self) -> Result<()>
Add rhs into self in place, producing the natural-parameter sum.
Sourcepub fn linf_residual(a: &Self, b: &Self) -> Result<f64>
pub fn linf_residual(a: &Self, b: &Self) -> Result<f64>
L∞ residual between two messages of identical shape. Useful for convergence monitoring in the engine.
Trait Implementations§
Source§impl Clone for VmpMessage
impl Clone for VmpMessage
Source§fn clone(&self) -> VmpMessage
fn clone(&self) -> VmpMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for VmpMessage
impl RefUnwindSafe for VmpMessage
impl Send for VmpMessage
impl Sync for VmpMessage
impl Unpin for VmpMessage
impl UnsafeUnpin for VmpMessage
impl UnwindSafe for VmpMessage
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.