pub struct SequentialSampler;Expand description
A basic, single-threaded sampler.
Trait Implementations§
Source§impl Default for SequentialSampler
impl Default for SequentialSampler
Source§fn default() -> SequentialSampler
fn default() -> SequentialSampler
Returns the “default value” for a type. Read more
Source§impl<T: ProbabilisticType> Sampler<T> for SequentialSampler
impl<T: ProbabilisticType> Sampler<T> for SequentialSampler
Source§fn sample(
&self,
root_node: &ConstTree<UncertainNodeContent>,
) -> Result<SampledValue, UncertainError>
fn sample( &self, root_node: &ConstTree<UncertainNodeContent>, ) -> Result<SampledValue, UncertainError>
Samples a value from the given root computation node.
This method initiates the sampling process by evaluating the computation graph
starting from the root_node. It uses a HashMap for memoization to avoid
recomputing values for the same node multiple times within a single sample operation.
§Arguments
root_node- AnArcto the rootComputationNodeof the graph to be sampled.
§Returns
A Result which is:
Ok(SampledValue)containing the sampled value if the sampling is successful.Err(UncertainError)if an error occurs during sampling (e.g., type mismatch, distribution error).
Auto Trait Implementations§
impl Freeze for SequentialSampler
impl RefUnwindSafe for SequentialSampler
impl Send for SequentialSampler
impl Sync for SequentialSampler
impl Unpin for SequentialSampler
impl UnwindSafe for SequentialSampler
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
Mutably borrows from an owned value. Read more