| 508 | } |
| 509 | |
| 510 | af_err af_hypot(af_array *out, const af_array lhs, const af_array rhs, |
| 511 | const bool batchMode) { |
| 512 | try { |
| 513 | const af_dtype type = implicit(lhs, rhs); |
| 514 | |
| 515 | if (type != f16 && type != f32 && type != f64) { |
| 516 | AF_ERROR("Only floating point arrays are supported for hypot ", |
| 517 | AF_ERR_NOT_SUPPORTED); |
| 518 | } |
| 519 | |
| 520 | const ArrayInfo &linfo = getInfo(lhs); |
| 521 | const ArrayInfo &rinfo = getInfo(rhs); |
| 522 | |
| 523 | dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode); |
| 524 | |
| 525 | if (odims.ndims() == 0) { |
| 526 | return af_create_handle(out, 0, nullptr, type); |
| 527 | } |
| 528 | |
| 529 | af_array res; |
| 530 | switch (type) { |
| 531 | case f16: res = arithOp<half, af_hypot_t>(lhs, rhs, odims); break; |
| 532 | case f32: res = arithOp<float, af_hypot_t>(lhs, rhs, odims); break; |
| 533 | case f64: res = arithOp<double, af_hypot_t>(lhs, rhs, odims); break; |
| 534 | default: TYPE_ERROR(0, type); |
| 535 | } |
| 536 | |
| 537 | std::swap(*out, res); |
| 538 | } |
| 539 | CATCHALL; |
| 540 | return AF_SUCCESS; |
| 541 | } |
| 542 | |
| 543 | template<typename T, af_op_t op> |
| 544 | static inline af_array logicOp(const af_array lhs, const af_array rhs, |
nothing calls this directly
no test coverage detected