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

Function af_root

src/api/c/binary.cpp:446–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446af_err af_root(af_array *out, const af_array lhs, const af_array rhs,
447 const bool batchMode) {
448 try {
449 const ArrayInfo &linfo = getInfo(lhs);
450 const ArrayInfo &rinfo = getInfo(rhs);
451 if (linfo.isComplex() || rinfo.isComplex()) {
452 af_array log_lhs, log_res;
453 af_array res;
454 AF_CHECK(af_log(&log_lhs, lhs));
455 AF_CHECK(af_div(&log_res, log_lhs, rhs, batchMode));
456 AF_CHECK(af_exp(&res, log_res));
457 std::swap(*out, res);
458 return AF_SUCCESS;
459 }
460
461 af_array one;
462 AF_CHECK(af_constant(&one, 1, linfo.ndims(), linfo.dims().get(),
463 linfo.getType()));
464
465 af_array inv_lhs;
466 AF_CHECK(af_div(&inv_lhs, one, lhs, batchMode));
467
468 AF_CHECK(af_arith_real<af_pow_t>(out, rhs, inv_lhs, batchMode));
469
470 AF_CHECK(af_release_array(one));
471 AF_CHECK(af_release_array(inv_lhs));
472 }
473 CATCHALL;
474
475 return AF_SUCCESS;
476}
477
478af_err af_atan2(af_array *out, const af_array lhs, const af_array rhs,
479 const bool batchMode) {

Callers

nothing calls this directly

Calls 9

af_divFunction · 0.85
swapFunction · 0.85
isComplexMethod · 0.80
af_constantFunction · 0.70
af_release_arrayFunction · 0.70
ndimsMethod · 0.45
getMethod · 0.45
dimsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected