Model

Trait Model 

Source
pub trait Model:
    Send
    + Sync
    + 'static {
    type Math<'model>: Math
       where Self: 'model;

    // Required methods
    fn math<R: Rng + ?Sized>(&self, rng: &mut R) -> Result<Self::Math<'_>>;
    fn init_position<R: Rng + ?Sized>(
        &self,
        rng: &mut R,
        position: &mut [f64],
    ) -> Result<()>;
}
Expand description

Trait for MCMC models with associated math backend and initialization.

Defines the interface for models that can be used with MCMC sampling algorithms. Provides access to mathematical operations needed for sampling and methods for initializing the sampling position.

The trait is thread-safe to enable parallel sampling scenarios.

Required Associated Types§

Source

type Math<'model>: Math where Self: 'model

The math backend used by this MCMC model.

Specifies which math implementation will be used for computing log probability densities, gradients, and other operations required during sampling.

The lifetime parameter allows the math backend to borrow from the model instance.

Required Methods§

Source

fn math<R: Rng + ?Sized>(&self, rng: &mut R) -> Result<Self::Math<'_>>

Returns the math backend for this model.

Source

fn init_position<R: Rng + ?Sized>( &self, rng: &mut R, position: &mut [f64], ) -> Result<()>

Initializes the starting position for MCMC sampling.

Sets initial values for the parameter vector. The starting position should be in a reasonable region where the log probability density is finite.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§