pub trait KernelScalar: Scalar {
// Required methods
fn linear_kernel(
layout: Layout,
m: usize,
n: usize,
k: usize,
x: &[Self],
ldx: usize,
y: Option<&[Self]>,
ldy: usize,
d: &mut [Self],
ldd: usize,
) -> Result<()>;
fn rbf_kernel(
layout: Layout,
m: usize,
n: usize,
k: usize,
x: &[Self],
ldx: usize,
y: Option<&[Self]>,
ldy: usize,
d: &mut [Self],
ldd: usize,
gamma: Self,
) -> Result<()>;
fn polynomial_kernel(
layout: Layout,
m: usize,
n: usize,
k: usize,
x: &[Self],
ldx: usize,
y: Option<&[Self]>,
ldy: usize,
d: &mut [Self],
ldd: usize,
gamma: Self,
degree: i64,
coef0: Self,
) -> Result<()>;
fn sigmoid_kernel(
layout: Layout,
m: usize,
n: usize,
k: usize,
x: &[Self],
ldx: usize,
y: Option<&[Self]>,
ldy: usize,
d: &mut [Self],
ldd: usize,
gamma: Self,
coef0: Self,
) -> Result<()>;
}Expand description
Scalar element type for kernel-matrix computations.
Required Methods§
Sourcefn linear_kernel(
layout: Layout,
m: usize,
n: usize,
k: usize,
x: &[Self],
ldx: usize,
y: Option<&[Self]>,
ldy: usize,
d: &mut [Self],
ldd: usize,
) -> Result<()>
fn linear_kernel( layout: Layout, m: usize, n: usize, k: usize, x: &[Self], ldx: usize, y: Option<&[Self]>, ldy: usize, d: &mut [Self], ldd: usize, ) -> Result<()>
Linear kernel: K(x, y) = x · y.
Sourcefn rbf_kernel(
layout: Layout,
m: usize,
n: usize,
k: usize,
x: &[Self],
ldx: usize,
y: Option<&[Self]>,
ldy: usize,
d: &mut [Self],
ldd: usize,
gamma: Self,
) -> Result<()>
fn rbf_kernel( layout: Layout, m: usize, n: usize, k: usize, x: &[Self], ldx: usize, y: Option<&[Self]>, ldy: usize, d: &mut [Self], ldd: usize, gamma: Self, ) -> Result<()>
RBF (Gaussian) kernel: K(x, y) = exp(-γ · ‖x − y‖²).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".