daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     let signal = &vec![0.0, 1.0, 2.0, 1.0, 0.0, -1.0, -2.0, -1.0];
  3.     let kernel = &vec![0.3, 0.4, 0.3];
  4.     let y: Vec<f64> = signal
  5.         .windows(kernel.len())
  6.         .map(|window| window.iter().zip(kernel).map(|(x, y)| x * y).sum())
  7.         .collect();
  8.  
  9.     println!("{:?}", y);
  10. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top