Skip to content

Commit 9bc3d73

Browse files
committed
Merge pull request #24 from jramapuram/hotfix/operator_convertible
fix the macro to accept a reference
2 parents e3f300f + 1a42b11 commit 9bc3d73

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/helloworld.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ fn main() {
1818

1919
println!("Element-wise arithmetic");
2020
let b = sin(&a)
21-
.and_then(|x| add(x, 1.5))
21+
.and_then(|x| add(&x, &1.5))
2222
.unwrap();
2323

2424
let b2 = sin(&a).
2525
and_then(|x| {
2626
cos(&a)
27-
.and_then(|y| add(x, y))
27+
.and_then(|y| add(&x, &y))
2828
})
2929
.unwrap();
3030

examples/histogram.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() {
3333

3434
let disp_img = man.dims()
3535
.and_then(|x| constant(255 as f32, x))
36-
.and_then(|x| div(man, x))
36+
.and_then(|x| div(&man, &x))
3737
.unwrap();
3838

3939
loop {

examples/pi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ fn main() {
1818
let start = PreciseTime::now();
1919

2020
for bench_iter in 0..100 {
21-
let pi_val = add(x*x, y*y)
21+
let pi_val = add(&mul(x, x).unwrap(), &mul(y, y).unwrap())
2222
.and_then( |z| sqrt(&z) )
23-
.and_then( |z| le(z, constant(1, dims).unwrap()) )
23+
.and_then( |z| le(&z, &constant(1, dims).unwrap()) )
2424
.and_then( |z| sum_all(&z) )
2525
.map( |z| z.0 * 4.0/(samples as f64) )
2626
.unwrap();

src/arith/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ macro_rules! overloaded_binary_func {
236236
}
237237
}
238238

239-
pub fn $fn_name<T: Convertable, U: Convertable> (arg1: T, arg2: U) -> Result<Array, AfError> {
239+
pub fn $fn_name<T: Convertable, U: Convertable> (arg1: &T, arg2: &U) -> Result<Array, AfError> {
240240
let lhs = arg1.convert();
241241
let rhs = arg2.convert();
242242
match (lhs.is_scalar().unwrap(), rhs.is_scalar().unwrap()) {

0 commit comments

Comments
 (0)