Trait nuts_rs::CpuLogpFunc

source ·
pub trait CpuLogpFunc {
    type Err: Debug + Send + Sync + LogpError + 'static;

    // Required methods
    fn logp(
        &mut self,
        position: &[f64],
        grad: &mut [f64]
    ) -> Result<f64, Self::Err>;
    fn dim(&self) -> usize;
}
Expand description

Compute the unnormalized log probability density of the posterior

This needs to be implemnted by users of the library to define what distribution the users wants to sample from.

Errors during that computation can be recoverable or non-recoverable. If a non-recoverable error occurs during sampling, the sampler will stop and return an error.

Required Associated Types§

source

type Err: Debug + Send + Sync + LogpError + 'static

Required Methods§

source

fn logp(&mut self, position: &[f64], grad: &mut [f64]) -> Result<f64, Self::Err>

source

fn dim(&self) -> usize

Implementors§