| 302 | } |
| 303 | |
| 304 | af_err af_mul(af_array *out, const af_array lhs, const af_array rhs, |
| 305 | const bool batchMode) { |
| 306 | try { |
| 307 | // Check if inputs are sparse |
| 308 | const ArrayInfo &linfo = getInfo(lhs, false); |
| 309 | const ArrayInfo &rinfo = getInfo(rhs, false); |
| 310 | |
| 311 | if (linfo.isSparse() && rinfo.isSparse()) { |
| 312 | // return af_arith_sparse<af_mul_t>(out, lhs, rhs); |
| 313 | // MKL doesn't have mul or div support yet, hence |
| 314 | // this is commented out although alternative cpu code exists |
| 315 | return AF_ERR_NOT_SUPPORTED; |
| 316 | } |
| 317 | if (linfo.isSparse() && !rinfo.isSparse()) { |
| 318 | return af_arith_sparse_dense<af_mul_t>(out, lhs, rhs); |
| 319 | } |
| 320 | if (!linfo.isSparse() && rinfo.isSparse()) { |
| 321 | return af_arith_sparse_dense<af_mul_t>( |
| 322 | out, rhs, lhs, |
| 323 | true); // dense should be rhs |
| 324 | } |
| 325 | return af_arith<af_mul_t>(out, lhs, rhs, batchMode); |
| 326 | } |
| 327 | CATCHALL; |
| 328 | } |
| 329 | |
| 330 | af_err af_sub(af_array *out, const af_array lhs, const af_array rhs, |
| 331 | const bool batchMode) { |