daily pastebin goal
89%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 58 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.windows(kernel.len()).map(|window| {
  5.         window.iter().zip(kernel).map(|(x,y)|x*y).sum()
  6.     }).collect();
  7.    
  8.     println!("{:?}", y);
  9. }
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