Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let signal = &vec![0.0, 1.0, 2.0, 1.0, 0.0, -1.0, -2.0, -1.0];
- let kernel = &vec![0.3, 0.4, 0.3];
- let y: Vec<f64> = signal
- .windows(kernel.len())
- .map(|window| window.iter().zip(kernel).map(|(x, y)| x * y).sum())
- .collect();
- println!("{:?}", y);
- }
Add Comment
Please, Sign In to add comment