| 358 | } |
| 359 | |
| 360 | af_err af_dot_all(double *rval, double *ival, const af_array lhs, |
| 361 | const af_array rhs, const af_mat_prop optLhs, |
| 362 | const af_mat_prop optRhs) { |
| 363 | using namespace detail; // NOLINT needed for imag and real functions |
| 364 | // name resolution |
| 365 | |
| 366 | try { |
| 367 | *rval = 0; |
| 368 | if (ival) { *ival = 0; } |
| 369 | |
| 370 | af_array out = 0; |
| 371 | AF_CHECK(af_dot(&out, lhs, rhs, optLhs, optRhs)); |
| 372 | |
| 373 | const ArrayInfo &lhsInfo = getInfo(lhs); |
| 374 | af_dtype lhs_type = lhsInfo.getType(); |
| 375 | |
| 376 | switch (lhs_type) { |
| 377 | case f16: *rval = static_cast<double>(dotAll<half>(out)); break; |
| 378 | case f32: *rval = dotAll<float>(out); break; |
| 379 | case f64: *rval = dotAll<double>(out); break; |
| 380 | case c32: { |
| 381 | cfloat temp = dotAll<cfloat>(out); |
| 382 | *rval = real(temp); |
| 383 | if (ival) { *ival = imag(temp); } |
| 384 | } break; |
| 385 | case c64: { |
| 386 | cdouble temp = dotAll<cdouble>(out); |
| 387 | *rval = real(temp); |
| 388 | if (ival) { *ival = imag(temp); } |
| 389 | } break; |
| 390 | default: TYPE_ERROR(1, lhs_type); |
| 391 | } |
| 392 | |
| 393 | if (out != 0) { AF_CHECK(af_release_array(out)); } |
| 394 | } |
| 395 | CATCHALL |
| 396 | return AF_SUCCESS; |
| 397 | } |
no test coverage detected