A high-performance general-purpose compute library
arith.h File Reference
#include <af/defines.h>

Go to the source code of this file.

Namespaces

namespace  af
 

Functions

AFAPI array min (const array &lhs, const array &rhs)
 C++ Interface to find the elementwise minimum between two arrays. More...
 
AFAPI array min (const array &lhs, const double rhs)
 C++ Interface to find the elementwise minimum between an array and a scalar value. More...
 
AFAPI array min (const double lhs, const array &rhs)
 C++ Interface to find the elementwise minimum between an array and a scalar value. More...
 
AFAPI array max (const array &lhs, const array &rhs)
 C++ Interface to find the elementwise maximum between two arrays. More...
 
AFAPI array max (const array &lhs, const double rhs)
 C++ Interface to find the elementwise maximum between an array and a scalar value. More...
 
AFAPI array max (const double lhs, const array &rhs)
 C++ Interface to find the elementwise maximum between an array and a scalar value. More...
 
AFAPI array abs (const array &in)
 C++ Interface to calculate the absolute value. More...
 
AFAPI array arg (const array &in)
 C++ Interface to calculate the phase angle (in radians) of a complex array. More...
 
AFAPI array sign (const array &in)
 C++ Interface to return the sign of elements in an array. More...
 
AFAPI array round (const array &in)
 C++ Interface to round numbers. More...
 
AFAPI array trunc (const array &in)
 C++ Interface to truncate numbers. More...
 
AFAPI array floor (const array &in)
 C++ Interface to floor numbers. More...
 
AFAPI array ceil (const array &in)
 C++ Interface to ceil numbers. More...
 
AFAPI array sin (const array &in)
 C++ Interface to evaluate the sine function. More...
 
AFAPI array cos (const array &in)
 C++ Interface to evaluate the cosine function. More...
 
AFAPI array tan (const array &in)
 C++ Interface to evaluate the tangent function. More...
 
AFAPI array asin (const array &in)
 C++ Interface to evaluate the inverse sine function. More...
 
AFAPI array acos (const array &in)
 C++ Interface to evaluate the inverse cosine function. More...
 
AFAPI array atan (const array &in)
 C++ Interface to evaluate the inverse tangent function. More...
 
AFAPI array sinh (const array &in)
 C++ Interface to evaluate the hyperbolic sine function. More...
 
AFAPI array cosh (const array &in)
 C++ Interface to evaluate the hyperbolic cosine function. More...
 
AFAPI array tanh (const array &in)
 C++ Interface to evaluate the hyperbolic tangent function. More...
 
AFAPI array asinh (const array &in)
 C++ Interface to evaluate the inverse hyperbolic sine function. More...
 
AFAPI array acosh (const array &in)
 C++ Interface to evaluate the inverse hyperbolic cosine function. More...
 
AFAPI array atanh (const array &in)
 C++ Interface to evaluate the inverse hyperbolic tangent function. More...
 
AFAPI array real (const array &in)
 C++ Interface to return the real part of a complex array. More...
 
AFAPI array imag (const array &in)
 C++ Interface to return the imaginary part of a complex array. More...
 
AFAPI array conjg (const array &in)
 C++ Interface to calculate the complex conjugate of an input array. More...
 
AFAPI array root (const array &nth_root, const array &value)
 C++ Interface to evaluate the nth root. More...
 
AFAPI array root (const array &nth_root, const double value)
 C++ Interface to evaluate the nth root. More...
 
AFAPI array root (const double nth_root, const array &value)
 C++ Interface to evaluate the nth root. More...
 
AFAPI array sigmoid (const array &in)
 C++ Interface to evaluate the logistical sigmoid function. More...
 
AFAPI array exp (const array &in)
 C++ Interface to evaluate the exponential. More...
 
AFAPI array expm1 (const array &in)
 C++ Interface to evaluate the exponential of an array minus 1, exp(in) - 1. More...
 
AFAPI array erf (const array &in)
 C++ Interface to evaluate the error function. More...
 
AFAPI array erfc (const array &in)
 C++ Interface to evaluate the complementary error function. More...
 
AFAPI array log (const array &in)
 C++ Interface to evaluate the natural logarithm. More...
 
AFAPI array log1p (const array &in)
 C++ Interface to evaluate the natural logarithm of 1 + input, ln(1+in). More...
 
AFAPI array log10 (const array &in)
 C++ Interface to evaluate the base 10 logarithm. More...
 
AFAPI array log2 (const array &in)
 C++ Interface to evaluate the base 2 logarithm. More...
 
AFAPI array sqrt (const array &in)
 C++ Interface to evaluate the square root. More...
 
AFAPI array rsqrt (const array &in)
 C++ Interface to evaluate the reciprocal square root. More...
 
AFAPI array cbrt (const array &in)
 C++ Interface to evaluate the cube root. More...
 
AFAPI array factorial (const array &in)
 C++ Interface to calculate the factorial. More...
 
AFAPI array tgamma (const array &in)
 C++ Interface to evaluate the gamma function. More...
 
AFAPI array lgamma (const array &in)
 C++ Interface to evaluate the logarithm of the absolute value of the gamma function. More...
 
AFAPI array iszero (const array &in)
 C++ Interface to check which values are zero. More...
 
AFAPI array isInf (const array &in)
 C++ Interface to check if values are infinite. More...
 
AFAPI array isNaN (const array &in)
 C++ Interface to check if values are NaN. More...
 
AFAPI af_err af_add (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to add two arrays. More...
 
AFAPI af_err af_sub (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to subtract one array from another array. More...
 
AFAPI af_err af_mul (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to multiply two arrays. More...
 
AFAPI af_err af_div (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to divide one array by another array. More...
 
AFAPI af_err af_lt (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to perform a less-than comparison between corresponding elements of two arrays. More...
 
AFAPI af_err af_gt (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to perform a greater-than comparison between corresponding elements of two arrays. More...
 
AFAPI af_err af_le (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to perform a less-than-or-equal comparison between corresponding elements of two arrays. More...
 
AFAPI af_err af_ge (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to perform a greater-than-or-equal comparison between corresponding elements of two arrays. More...
 
AFAPI af_err af_eq (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to check if corresponding elements of two arrays are equal. More...
 
AFAPI af_err af_neq (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to check if corresponding elements of two arrays are not equal. More...
 
AFAPI af_err af_and (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to evaluate the logical AND of two arrays. More...
 
AFAPI af_err af_or (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface the evaluate the logical OR of two arrays. More...
 
AFAPI af_err af_not (af_array *out, const af_array in)
 C Interface to evaluate the logical NOT of an array. More...
 
AFAPI af_err af_bitnot (af_array *out, const af_array in)
 C Interface to evaluate the bitwise NOT of an array. More...
 
AFAPI af_err af_bitand (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to evaluate the bitwise AND of two arrays. More...
 
AFAPI af_err af_bitor (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to evaluate the bitwise OR of two arrays. More...
 
AFAPI af_err af_bitxor (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to evaluate the bitwise XOR of two arrays. More...
 
AFAPI af_err af_bitshiftl (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to shift the bits of integer arrays left. More...
 
AFAPI af_err af_bitshiftr (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to shift the bits of integer arrays right. More...
 
AFAPI af_err af_cast (af_array *out, const af_array in, const af_dtype type)
 C Interface to cast an array from one type to another. More...
 
AFAPI af_err af_minof (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to find the elementwise minimum between two arrays. More...
 
AFAPI af_err af_maxof (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to find the elementwise minimum between an array and a scalar value. More...
 
AFAPI af_err af_clamp (af_array *out, const af_array in, const af_array lo, const af_array hi, const bool batch)
 C Interface to clamp an array between an upper and a lower limit. More...
 
AFAPI af_err af_rem (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to calculate the remainder. More...
 
AFAPI af_err af_mod (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to calculate the modulus. More...
 
AFAPI af_err af_abs (af_array *out, const af_array in)
 C Interface to calculate the absolute value. More...
 
AFAPI af_err af_arg (af_array *out, const af_array in)
 C Interface to calculate the phase angle (in radians) of a complex array. More...
 
AFAPI af_err af_sign (af_array *out, const af_array in)
 C Interface to calculate the sign of elements in an array. More...
 
AFAPI af_err af_round (af_array *out, const af_array in)
 C Interface to round numbers. More...
 
AFAPI af_err af_trunc (af_array *out, const af_array in)
 C Interface to truncate numbers. More...
 
AFAPI af_err af_floor (af_array *out, const af_array in)
 C Interface to floor numbers. More...
 
AFAPI af_err af_ceil (af_array *out, const af_array in)
 C Interface to ceil numbers. More...
 
AFAPI af_err af_hypot (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to calculate the length of the hypotenuse of two inputs. More...
 
AFAPI af_err af_sin (af_array *out, const af_array in)
 C Interface to evaluate the sine function. More...
 
AFAPI af_err af_cos (af_array *out, const af_array in)
 C Interface to evaluate the cosine function. More...
 
AFAPI af_err af_tan (af_array *out, const af_array in)
 C Interface to evaluate the tangent function. More...
 
AFAPI af_err af_asin (af_array *out, const af_array in)
 C Interface to evaluate the inverse sine function. More...
 
AFAPI af_err af_acos (af_array *out, const af_array in)
 C Interface to evaluate the inverse cosine function. More...
 
AFAPI af_err af_atan (af_array *out, const af_array in)
 C Interface to evaluate the inverse tangent function. More...
 
AFAPI af_err af_atan2 (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to evaluate the inverse tangent of two arrays. More...
 
AFAPI af_err af_sinh (af_array *out, const af_array in)
 C Interface to evaluate the hyperbolic sine function. More...
 
AFAPI af_err af_cosh (af_array *out, const af_array in)
 C Interface to evaluate the hyperbolic cosine function. More...
 
AFAPI af_err af_tanh (af_array *out, const af_array in)
 C Interface to evaluate the hyperbolic tangent function. More...
 
AFAPI af_err af_asinh (af_array *out, const af_array in)
 C Interface to evaluate the inverse hyperbolic sine function. More...
 
AFAPI af_err af_acosh (af_array *out, const af_array in)
 C Interface to evaluate the inverse hyperbolic cosine function. More...
 
AFAPI af_err af_atanh (af_array *out, const af_array in)
 C Interface to evaluate the inverse hyperbolic tangent function. More...
 
AFAPI af_err af_cplx (af_array *out, const af_array in)
 C Interface to create a complex array from a single real array. More...
 
AFAPI af_err af_cplx2 (af_array *out, const af_array real, const af_array imag, const bool batch)
 C Interface to create a complex array from two real arrays. More...
 
AFAPI af_err af_real (af_array *out, const af_array in)
 C Interface to return the real part of a complex array. More...
 
AFAPI af_err af_imag (af_array *out, const af_array in)
 C Interface to return the imaginary part of a complex array. More...
 
AFAPI af_err af_conjg (af_array *out, const af_array in)
 C Interface to evaluate the complex conjugate of an input array. More...
 
AFAPI af_err af_root (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to evaluate the nth root. More...
 
AFAPI af_err af_pow (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
 C Interface to raise a base to a power (or exponent). More...
 
AFAPI af_err af_pow2 (af_array *out, const af_array in)
 C Interface to raise 2 to a power (or exponent). More...
 
AFAPI af_err af_sigmoid (af_array *out, const af_array in)
 C Interface to evaluate the logistical sigmoid function. More...
 
AFAPI af_err af_exp (af_array *out, const af_array in)
 C Interface to evaluate the exponential. More...
 
AFAPI af_err af_expm1 (af_array *out, const af_array in)
 C Interface to evaluate the exponential of an array minus 1, exp(in) - 1. More...
 
AFAPI af_err af_erf (af_array *out, const af_array in)
 C Interface to evaluate the error function. More...
 
AFAPI af_err af_erfc (af_array *out, const af_array in)
 C Interface to evaluate the complementary error function. More...
 
AFAPI af_err af_log (af_array *out, const af_array in)
 C Interface to evaluate the natural logarithm. More...
 
AFAPI af_err af_log1p (af_array *out, const af_array in)
 C Interface to evaluate the natural logarithm of 1 + input, ln(1+in). More...
 
AFAPI af_err af_log10 (af_array *out, const af_array in)
 C Interface to evaluate the base 10 logarithm. More...
 
AFAPI af_err af_log2 (af_array *out, const af_array in)
 C Interface to evaluate the base 2 logarithm. More...
 
AFAPI af_err af_sqrt (af_array *out, const af_array in)
 C Interface to evaluate the square root. More...
 
AFAPI af_err af_rsqrt (af_array *out, const af_array in)
 C Interface to evaluate the reciprocal square root. More...
 
AFAPI af_err af_cbrt (af_array *out, const af_array in)
 C Interface to evaluate the cube root. More...
 
AFAPI af_err af_factorial (af_array *out, const af_array in)
 C Interface to calculate the factorial. More...
 
AFAPI af_err af_tgamma (af_array *out, const af_array in)
 C Interface to evaluate the gamma function. More...
 
AFAPI af_err af_lgamma (af_array *out, const af_array in)
 C Interface to evaluate the logarithm of the absolute value of the gamma function. More...
 
AFAPI af_err af_iszero (af_array *out, const af_array in)
 C Interface to check if values are zero. More...
 
AFAPI af_err af_isinf (af_array *out, const af_array in)
 C Interface to check if values are infinite. More...
 
AFAPI af_err af_isnan (af_array *out, const af_array in)
 C Interface to check if values are NaN. More...
 
AFAPI array clamp (const array &in, const array &lo, const array &hi)
 
AFAPI array clamp (const array &in, const array &lo, const double hi)
 
AFAPI array clamp (const array &in, const double lo, const array &hi)
 
AFAPI array clamp (const array &in, const double lo, const double hi)
 
AFAPI array rem (const array &lhs, const array &rhs)
 
AFAPI array rem (const array &lhs, const double rhs)
 
AFAPI array rem (const double lhs, const array &rhs)
 
AFAPI array mod (const array &lhs, const array &rhs)
 
AFAPI array mod (const array &lhs, const double rhs)
 
AFAPI array mod (const double lhs, const array &rhs)
 
AFAPI array hypot (const array &lhs, const array &rhs)
 C++ Interface to calculate the length of the hypotenuse of two inputs. More...
 
AFAPI array hypot (const array &lhs, const double rhs)
 C++ Interface to calculate the length of the hypotenuse of two inputs. More...
 
AFAPI array hypot (const double lhs, const array &rhs)
 C++ Interface to calculate the length of the hypotenuse of two inputs. More...
 
AFAPI array atan2 (const array &lhs, const array &rhs)
 C++ Interface to evaluate the inverse tangent of two arrays. More...
 
AFAPI array atan2 (const array &lhs, const double rhs)
 C++ Interface to evaluate the inverse tangent of two arrays. More...
 
AFAPI array atan2 (const double lhs, const array &rhs)
 C++ Interface to evaluate the inverse tangent of two arrays. More...
 
AFAPI array complex (const array &in)
 C++ Interface to create a complex array from a single real array. More...
 
AFAPI array complex (const array &real_, const array &imag_)
 C++ Interface to create a complex array from two real arrays. More...
 
AFAPI array complex (const array &real_, const double imag_)
 C++ Interface to create a complex array from a single real array for the real component and a single scalar for each imaginary component. More...
 
AFAPI array complex (const double real_, const array &imag_)
 C++ Interface to create a complex array from a single scalar for each real component and a single real array for the imaginary component. More...
 
AFAPI array pow (const array &base, const array &exponent)
 C++ Interface to raise a base to a power (or exponent). More...
 
AFAPI array pow (const array &base, const double exponent)
 C++ Interface to raise a base to a power (or exponent). More...
 
AFAPI array pow (const double base, const array &exponent)
 C++ Interface to raise a base to a power (or exponent). More...
 
AFAPI array pow2 (const array &in)
 C++ Interface to raise 2 to a power (or exponent). More...
 

Function Documentation

◆ af_log2()

AFAPI af_err af_log2 ( af_array out,
const af_array  in 
)

C Interface to evaluate the base 2 logarithm.

Parameters
[out]outbase 2 logarithm
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_lt()

AFAPI af_err af_lt ( af_array out,
const af_array  lhs,
const af_array  rhs,
const bool  batch 
)

C Interface to perform a less-than comparison between corresponding elements of two arrays.

Output type is b8.

Parameters
[out]out1's where lhs < rhs, else 0's
[in]lhsfirst input
[in]rhssecond input
[in]batchbatch mode
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given