diff --git a/examples/helloworld.rs b/examples/helloworld.rs index 779325ff9..e6dff241a 100644 --- a/examples/helloworld.rs +++ b/examples/helloworld.rs @@ -18,13 +18,13 @@ fn main() { println!("Element-wise arithmetic"); let b = sin(&a) - .and_then(|x| add(x, 1.5)) + .and_then(|x| add(&x, &1.5)) .unwrap(); let b2 = sin(&a). and_then(|x| { cos(&a) - .and_then(|y| add(x, y)) + .and_then(|y| add(&x, &y)) }) .unwrap(); diff --git a/examples/histogram.rs b/examples/histogram.rs index da07773bb..0984740d5 100644 --- a/examples/histogram.rs +++ b/examples/histogram.rs @@ -33,7 +33,7 @@ fn main() { let disp_img = man.dims() .and_then(|x| constant(255 as f32, x)) - .and_then(|x| div(man, x)) + .and_then(|x| div(&man, &x)) .unwrap(); loop { diff --git a/examples/pi.rs b/examples/pi.rs index d4750d1e6..1fb4ef520 100644 --- a/examples/pi.rs +++ b/examples/pi.rs @@ -18,9 +18,9 @@ fn main() { let start = PreciseTime::now(); for bench_iter in 0..100 { - let pi_val = add(x*x, y*y) + let pi_val = add(&mul(x, x).unwrap(), &mul(y, y).unwrap()) .and_then( |z| sqrt(&z) ) - .and_then( |z| le(z, constant(1, dims).unwrap()) ) + .and_then( |z| le(&z, &constant(1, dims).unwrap()) ) .and_then( |z| sum_all(&z) ) .map( |z| z.0 * 4.0/(samples as f64) ) .unwrap(); diff --git a/src/arith/mod.rs b/src/arith/mod.rs index e2e792e61..5c085d6a5 100644 --- a/src/arith/mod.rs +++ b/src/arith/mod.rs @@ -236,7 +236,7 @@ macro_rules! overloaded_binary_func { } } - pub fn $fn_name (arg1: T, arg2: U) -> Result { + pub fn $fn_name (arg1: &T, arg2: &U) -> Result { let lhs = arg1.convert(); let rhs = arg2.convert(); match (lhs.is_scalar().unwrap(), rhs.is_scalar().unwrap()) {