Skip to content

Commit df0874e

Browse files
author
Jason Ramapuram
committed
allow batch operations
1 parent 8cbe77e commit df0874e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/arith/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,32 +223,32 @@ impl Convertable for Array {
223223

224224
macro_rules! overloaded_binary_func {
225225
($fn_name: ident, $help_name: ident, $ffi_name: ident) => (
226-
fn $help_name(lhs: &Array, rhs: &Array) -> Result<Array, AfError> {
226+
fn $help_name(lhs: &Array, rhs: &Array, batch: bool) -> Result<Array, AfError> {
227227
unsafe {
228228
let mut temp: i64 = 0;
229229
let err_val = $ffi_name(&mut temp as MutAfArray,
230230
lhs.get() as AfArray, rhs.get() as AfArray,
231-
0);
231+
batch as c_int);
232232
match err_val {
233233
0 => Ok(Array::from(temp)),
234234
_ => Err(AfError::from(err_val)),
235235
}
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, batch: bool) -> Result<Array, AfError> {
240240
let lhs = arg1.convert();
241241
let rhs = arg2.convert();
242242
match (lhs.is_scalar().unwrap(), rhs.is_scalar().unwrap()) {
243243
( true, false) => {
244244
let l = tile(&lhs, rhs.dims().unwrap()).unwrap();
245-
$help_name(&l, &rhs)
245+
$help_name(&l, &rhs, batch)
246246
},
247247
(false, true) => {
248248
let r = tile(&rhs, lhs.dims().unwrap()).unwrap();
249-
$help_name(&lhs, &r)
249+
$help_name(&lhs, &r, batch)
250250
},
251-
_ => $help_name(&lhs, &rhs),
251+
_ => $help_name(&lhs, &rhs, batch),
252252
}
253253
}
254254
)

0 commit comments

Comments
 (0)