nalgebra/examples/convolution.rs

17 lines
539 B
Rust
Raw Normal View History

2019-02-21 10:32:09 +08:00
extern crate nalgebra;
use nalgebra::{Vector2,Vector3,Vector4,Vector5,convolve_full,convolve_same,convolve_valid};
2019-02-15 10:54:26 +08:00
fn main(){
2019-02-21 10:32:09 +08:00
let vec = Vector4::new(1.0,2.0,3.0,4.0);
let ker = Vector3::new(1.0,2.0,2.1);
let actual = Vector5::from_vec(vec![1.0,4.0,7.0,10.0,8.0]);
2019-02-15 10:54:26 +08:00
2019-02-21 10:32:09 +08:00
let expected = convolve_full(vec,ker);
let expected2 = convolve_same(vec,ker);
// let expected3 = convolve_valid(vec,ker);
println!("{}", actual);
println!("{}", expected);
println!("{}", expected2);
// println!("{}", expected3);
2019-02-15 10:54:26 +08:00
}