| 351 | } |
| 352 | |
| 353 | af_err af_div(af_array *out, const af_array lhs, const af_array rhs, |
| 354 | const bool batchMode) { |
| 355 | try { |
| 356 | // Check if inputs are sparse |
| 357 | const ArrayInfo &linfo = getInfo(lhs, false); |
| 358 | const ArrayInfo &rinfo = getInfo(rhs, false); |
| 359 | |
| 360 | if (linfo.isSparse() && rinfo.isSparse()) { |
| 361 | // return af_arith_sparse<af_div_t>(out, lhs, rhs); |
| 362 | // MKL doesn't have mul or div support yet, hence |
| 363 | // this is commented out although alternative cpu code exists |
| 364 | return AF_ERR_NOT_SUPPORTED; |
| 365 | } |
| 366 | if (linfo.isSparse() && !rinfo.isSparse()) { |
| 367 | return af_arith_sparse_dense<af_div_t>(out, lhs, rhs); |
| 368 | } |
| 369 | if (!linfo.isSparse() && rinfo.isSparse()) { |
| 370 | // Division by sparse is currently not allowed - for convinence of |
| 371 | // dealing with division by 0 |
| 372 | // return af_arith_sparse_dense<af_div_t>(out, rhs, lhs, true); // |
| 373 | // dense should be rhs |
| 374 | return AF_ERR_NOT_SUPPORTED; |
| 375 | } |
| 376 | return af_arith<af_div_t>(out, lhs, rhs, batchMode); |
| 377 | } |
| 378 | CATCHALL; |
| 379 | } |
| 380 | |
| 381 | af_err af_maxof(af_array *out, const af_array lhs, const af_array rhs, |
| 382 | const bool batchMode) { |