signal::ops
On this page
- Traits
Convolve1Correlate1
Convolution and correlation as operators: a ⊛ b (U+229B, circled
asterisk) is the full linear convolution and a ⋆ b (U+22C6, star
operator) the full cross-correlation, both at the level of *. They
are convolve / correlate with the defaults, and convolve2d /
correlate2d on matrices. Input with no samples gives an empty
result, so the operators never throw.
Traits
ConvolveSource
pub trait Convolve<Rhs = Self>a ⊛ b: the full linear convolution.
nabi
use core::array::Vector;
let a: Vector<f64> = [1, 2, 3];
let k: Vector<f64> = [1, 1];
println(a ⊛ k); // [1.0, 3.0, 5.0, 3.0]
println(a ⊛ k .* 2.0); // [2.0, 6.0, 10.0, 6.0]: same level as `*`, left to right
The full convolution of
selfandrhs.
CorrelateSource
pub trait Correlate<Rhs = Self>a ⋆ b: the full cross-correlation, lag 0 at index b.len() - 1.
nabi
use core::array::Vector;
let a: Vector<f64> = [0, 1, 2, 0];
let b: Vector<f64> = [1, 2];
println(a ⋆ b); // [0.0, 2.0, 5.0, 2.0, 0.0]
The full cross-correlation of
selfwithrhs.