MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_atan2

Function af_atan2

src/api/c/binary.cpp:478–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478af_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
510af_err af_hypot(af_array *out, const af_array lhs, const af_array rhs,
511 const bool batchMode) {

Callers 1

af_argFunction · 0.85

Calls 6

implicitFunction · 0.85
getOutDimsFunction · 0.85
swapFunction · 0.85
af_create_handleFunction · 0.70
dimsMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected