Fixing documentation

This commit is contained in:
Nathan 2019-02-20 20:32:09 -06:00
parent 9f52019385
commit 2a2debf58b
2 changed files with 25 additions and 37 deletions

View File

@ -1,5 +1,17 @@
fn main(){ extern crate nalgebra;
let (x,y) = (1,2); use nalgebra::{Vector2,Vector3,Vector4,Vector5,convolve_full,convolve_same,convolve_valid};
println!("{}", x); fn main(){
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]);
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);
} }

View File

@ -12,18 +12,10 @@ use {zero, Real, Vector, VectorN, U1};
/// * `vector` - A Vector with size > 0 /// * `vector` - A Vector with size > 0
/// * `kernel` - A Vector with size > 0 /// * `kernel` - A Vector with size > 0
/// ///
/// # Note: /// This function is commutative. If kernel > vector,
/// This function is commutative. If kernel > vector, /// they will swap their roles as in
/// they will swap their roles as in /// (self, kernel) = (kernel,self)
/// (self, kernel) = (kernel,self)
/// ///
/// # Example
///
/// ```
/// let vec = Vector3::new(1.0,2.0,3.0);
/// let ker = Vector2::new(0.4,0.6);
/// let convolve = convolve_full(vec,ker);
/// ```
pub fn convolve_full<N, D1, D2, S1, S2>( pub fn convolve_full<N, D1, D2, S1, S2>(
vector: Vector<N, D1, S1>, vector: Vector<N, D1, S1>,
kernel: Vector<N, D2, S2>, kernel: Vector<N, D2, S2>,
@ -77,19 +69,11 @@ where
/// ///
/// * `vector` - A Vector with size > 0 /// * `vector` - A Vector with size > 0
/// * `kernel` - A Vector with size > 0 /// * `kernel` - A Vector with size > 0
///
/// This function is commutative. If kernel > vector,
/// they will swap their roles as in
/// (self, kernel) = (kernel,self)
/// ///
/// # Note:
/// This function is commutative. If kernel > vector,
/// they will swap their roles as in
/// (self, kernel) = (kernel,self)
///
/// # Example
///
/// ```
/// let vec = Vector3::new(1.0,2.0,3.0);
/// let ker = Vector2::new(0.4,0.6);
/// let convolve = convolve_valid(vec,ker);
/// ```
pub fn convolve_valid<N, D1, D2, S1, S2>( pub fn convolve_valid<N, D1, D2, S1, S2>(
vector: Vector<N, D1, S1>, vector: Vector<N, D1, S1>,
kernel: Vector<N, D2, S2>, kernel: Vector<N, D2, S2>,
@ -133,18 +117,10 @@ where
/// * `vector` - A Vector with size > 0 /// * `vector` - A Vector with size > 0
/// * `kernel` - A Vector with size > 0 /// * `kernel` - A Vector with size > 0
/// ///
/// # Note: /// This function is commutative. If kernel > vector,
/// This function is commutative. If kernel > vector, /// they will swap their roles as in
/// they will swap their roles as in /// (self, kernel) = (kernel,self)
/// (self, kernel) = (kernel,self)
/// ///
/// # Example
///
/// ```
/// let vec = Vector3::new(1.0,2.0,3.0);
/// let ker = Vector2::new(0.4,0.6);
/// let convolve = convolve_same(vec,ker);
/// ```
pub fn convolve_same<N, D1, D2, S1, S2>( pub fn convolve_same<N, D1, D2, S1, S2>(
vector: Vector<N, D1, S1>, vector: Vector<N, D1, S1>,
kernel: Vector<N, D2, S2>, kernel: Vector<N, D2, S2>,