Trait basic_dsp_vector::DotProductOps
source · pub trait DotProductOps<A, R, T, N, D>{
type Output;
// Required method
fn dot_product(&self, factor: &A) -> Self::Output;
}
Expand description
An operation which multiplies each vector element with a constant
Required Associated Types§
Required Methods§
sourcefn dot_product(&self, factor: &A) -> Self::Output
fn dot_product(&self, factor: &A) -> Self::Output
Calculates the dot product of self and factor. Self and factor remain unchanged.
§Example
use basic_dsp_vector::*;
let vector1 = vec!(2.0, 1.0, -1.0, 4.0).to_real_time_vec();
let vector2 = vec!(3.0, 4.0, -1.0, -2.0).to_real_time_vec();
let product = vector1.dot_product(&vector2).expect("Ignoring error handling in examples");
assert_eq!(3.0, product);