Skip to main content

Kernel

Trait Kernel 

Source
pub trait Kernel:
    Clone
    + Send
    + Sync {
    // Required methods
    fn compute(&self, x1: &ArrayView1<'_, f64>, x2: &ArrayView1<'_, f64>) -> f64;
    fn get_params(&self) -> Vec<f64>;
    fn set_params(&mut self, params: &[f64]);

    // Provided methods
    fn compute_matrix(&self, x: &Array2<f64>) -> Array2<f64> { ... }
    fn compute_cross_matrix(
        &self,
        x1: &Array2<f64>,
        x2: &Array2<f64>,
    ) -> Array2<f64> { ... }
    fn n_params(&self) -> usize { ... }
}
Expand description

Trait for kernel functions (covariance functions)

Required Methods§

Source

fn compute(&self, x1: &ArrayView1<'_, f64>, x2: &ArrayView1<'_, f64>) -> f64

Compute covariance between two points

Source

fn get_params(&self) -> Vec<f64>

Get kernel parameters (for optimization)

Source

fn set_params(&mut self, params: &[f64])

Set kernel parameters

Provided Methods§

Source

fn compute_matrix(&self, x: &Array2<f64>) -> Array2<f64>

Compute covariance matrix for a set of points

Source

fn compute_cross_matrix( &self, x1: &Array2<f64>, x2: &Array2<f64>, ) -> Array2<f64>

Compute covariance matrix between two sets of points

Source

fn n_params(&self) -> usize

Get number of parameters

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§