| 476 | } |
| 477 | |
| 478 | af_err af_atan2(af_array *out, const af_array lhs, const af_array rhs, |
| 479 | const bool batchMode) { |
| 480 | try { |
| 481 | const af_dtype type = implicit(lhs, rhs); |
| 482 | |
| 483 | if (type != f16 && type != f32 && type != f64) { |
| 484 | AF_ERROR("Only floating point arrays are supported for atan2 ", |
| 485 | AF_ERR_NOT_SUPPORTED); |
| 486 | } |
| 487 | |
| 488 | const ArrayInfo &linfo = getInfo(lhs); |
| 489 | const ArrayInfo &rinfo = getInfo(rhs); |
| 490 | |
| 491 | dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode); |
| 492 | if (odims.ndims() == 0) { |
| 493 | return af_create_handle(out, 0, nullptr, type); |
| 494 | } |
| 495 | |
| 496 | af_array res; |
| 497 | switch (type) { |
| 498 | case f16: res = arithOp<half, af_atan2_t>(lhs, rhs, odims); break; |
| 499 | case f32: res = arithOp<float, af_atan2_t>(lhs, rhs, odims); break; |
| 500 | case f64: res = arithOp<double, af_atan2_t>(lhs, rhs, odims); break; |
| 501 | default: TYPE_ERROR(0, type); |
| 502 | } |
| 503 | |
| 504 | std::swap(*out, res); |
| 505 | } |
| 506 | CATCHALL; |
| 507 | return AF_SUCCESS; |
| 508 | } |
| 509 | |
| 510 | af_err af_hypot(af_array *out, const af_array lhs, const af_array rhs, |
| 511 | const bool batchMode) { |
no test coverage detected