arith.h File Reference

Namespaces | Functions
arith.h File Reference
`#include <af/defines.h>`

Go to the source code of this file.

## Namespaces
| af

## Functions
AFAPI array | clamp (const array &in, const double lo, const double hi)
| C++ Interface for clamping an array between two values. More...
AFAPI array | abs (const array &in)
| C++ Interface for absolute value. More...
AFAPI array | arg (const array &in)
| C++ Interface for arg. More...
AFAPI array | sign (const array &in)
| C++ Interface for getting the sign of input. More...
AFAPI array | round (const array &in)
| C++ Interface for rounding an array of numbers. More...
AFAPI array | trunc (const array &in)
| C++ Interface for truncating an array of numbers. More...
AFAPI array | floor (const array &in)
| C++ Interface for flooring an array of numbers. More...
AFAPI array | ceil (const array &in)
| C++ Interface for ceiling an array of numbers. More...
AFAPI array | sin (const array &in)
| C++ Interface for sin. More...
AFAPI array | cos (const array &in)
| C++ Interface for cos. More...
AFAPI array | tan (const array &in)
| C++ Interface for tan. More...
AFAPI array | asin (const array &in)
| C++ Interface for arc sin (sin inverse) More...
AFAPI array | acos (const array &in)
| C++ Interface for arc cos (cos inverse) More...
AFAPI array | atan (const array &in)
| C++ Interface for arc tan (tan inverse) More...
AFAPI array | real (const array &in)
| C++ Interface for getting real part from complex array. More...
AFAPI array | imag (const array &in)
| C++ Interface for getting imaginary part from complex array. More...
AFAPI array | conjg (const array &in)
| C++ Interface for getting the complex conjugate of input array. More...
AFAPI array | sinh (const array &in)
| C++ Interface for sinh. More...
AFAPI array | cosh (const array &in)
| C++ Interface for cosh. More...
AFAPI array | tanh (const array &in)
| C++ Interface for tanh. More...
AFAPI array | asinh (const array &in)
| C++ Interface for sinh inverse. More...
AFAPI array | acosh (const array &in)
| C++ Interface for cosh inverse. More...
AFAPI array | atanh (const array &in)
| C++ Interface for tanh inverse. More...
AFAPI array | root (const array &lhs, const array &rhs)
| C++ Interface for nth root. More...
AFAPI array | root (const array &lhs, const double rhs)
| C++ Interface for nth root. More...
AFAPI array | root (const double lhs, const array &rhs)
| C++ Interface for nth root. More...
AFAPI array | sigmoid (const array &in)
| C++ Interface for calculating sigmoid function of an array. More...
AFAPI array | exp (const array &in)
| C++ Interface for exponential of an array. More...
AFAPI array | expm1 (const array &in)
| C++ Interface for exponential of an array minus 1. More...
AFAPI array | erf (const array &in)
| C++ Interface for error function value. More...
AFAPI array | erfc (const array &in)
| C++ Interface for complementary error function value. More...
AFAPI array | log (const array &in)
| C++ Interface for natural logarithm. More...
AFAPI array | log1p (const array &in)
| C++ Interface for natural logarithm of 1 + input. More...
AFAPI array | log10 (const array &in)
| C++ Interface for logarithm base 10. More...
AFAPI array | log2 (const array &in)
| C++ Interface for logarithm base 2. More...
AFAPI array | sqrt (const array &in)
| C++ Interface for square root of input. More...
AFAPI array | cbrt (const array &in)
| C++ Interface for cube root of input. More...
AFAPI array | factorial (const array &in)
| C++ Interface for factorial of input. More...
AFAPI array | tgamma (const array &in)
| C++ Interface for gamma function of input. More...
AFAPI array | lgamma (const array &in)
| C++ Interface for logarithm of absolute value of gamma function of input. More...
AFAPI array | iszero (const array &in)
| C++ Interface for checking if values are zero. More...
AFAPI array | isInf (const array &in)
| C++ Interface for checking if values are Infinities. More...
AFAPI array | isNaN (const array &in)
| C++ Interface for checking if values are NaNs. More...
AFAPI af_err | af_add (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for adding arrays. More...
AFAPI af_err | af_sub (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for subtracting an array from another. More...
AFAPI af_err | af_mul (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for multiplying two arrays. More...
AFAPI af_err | af_div (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for dividing an array by another. More...
AFAPI af_err | af_lt (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for checking if an array is less than another. More...
AFAPI af_err | af_gt (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for checking if an array is greater than another. More...
AFAPI af_err | af_le (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for checking if an array is less or equal to another. More...
AFAPI af_err | af_ge (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for checking if an array is greater or equal to another. More...
AFAPI af_err | af_eq (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for checking if an array is equal to another. More...
AFAPI af_err | af_neq (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for checking if an array is not equal to another. More...
AFAPI af_err | af_and (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for performing logical and on two arrays. More...
AFAPI af_err | af_or (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for performing logical or on two arrays. More...
AFAPI af_err | af_not (af_array *out, const af_array in)
| C Interface for performing logical not on input. More...
AFAPI af_err | af_bitand (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for performing bitwise and on two arrays. More...
AFAPI af_err | af_bitor (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for performing bitwise or on two arrays. More...
AFAPI af_err | af_bitxor (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for performing bitwise xor on two arrays. More...
AFAPI af_err | af_bitshiftl (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for left shift on integer arrays. More...
AFAPI af_err | af_bitshiftr (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for right shift on integer arrays. More...
AFAPI af_err | af_cast (af_array *out, const af_array in, const af_dtype type)
| C Interface for casting 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 for min of two arrays. More...
AFAPI af_err | af_maxof (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for max of two arrays. 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 for max of two arrays. More...
AFAPI af_err | af_rem (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for remainder. More...
AFAPI af_err | af_mod (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for modulus. More...
AFAPI af_err | af_abs (af_array *out, const af_array in)
| C Interface for absolute value. More...
AFAPI af_err | af_arg (af_array *out, const af_array in)
| C Interface for finding the phase. More...
AFAPI af_err | af_sign (af_array *out, const af_array in)
| C Interface for finding the sign of the input. More...
AFAPI af_err | af_round (af_array *out, const af_array in)
| C Interface for rounding an array of numbers. More...
AFAPI af_err | af_trunc (af_array *out, const af_array in)
| C Interface for truncating an array of numbers. More...
AFAPI af_err | af_floor (af_array *out, const af_array in)
| C Interface for flooring an array of numbers. More...
AFAPI af_err | af_ceil (af_array *out, const af_array in)
| C Interface for ceiling an array of numbers. More...
AFAPI af_err | af_hypot (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for getting length of hypotenuse of two arrays. More...
AFAPI af_err | af_sin (af_array *out, const af_array in)
| C Interface for sin. More...
AFAPI af_err | af_cos (af_array *out, const af_array in)
| C Interface for cos. More...
AFAPI af_err | af_tan (af_array *out, const af_array in)
| C Interface for tan. More...
AFAPI af_err | af_asin (af_array *out, const af_array in)
| C Interface for arc sin. More...
AFAPI af_err | af_acos (af_array *out, const af_array in)
| C Interface for arc cos. More...
AFAPI af_err | af_atan (af_array *out, const af_array in)
| C Interface for arc tan. More...
AFAPI af_err | af_atan2 (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for arc tan of two inputs. More...
AFAPI af_err | af_cplx2 (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for creating complex array from two input arrays. More...
AFAPI af_err | af_cplx (af_array *out, const af_array in)
| C Interface for creating complex array from real array. More...
AFAPI af_err | af_real (af_array *out, const af_array in)
| C Interface for getting real part from complex array. More...
AFAPI af_err | af_imag (af_array *out, const af_array in)
| C Interface for getting imaginary part from complex array. More...
AFAPI af_err | af_conjg (af_array *out, const af_array in)
| C Interface for getting the complex conjugate of input array. More...
AFAPI af_err | af_sinh (af_array *out, const af_array in)
| C Interface for sinh. More...
AFAPI af_err | af_cosh (af_array *out, const af_array in)
| C Interface for cosh. More...
AFAPI af_err | af_tanh (af_array *out, const af_array in)
| C Interface for tanh. More...
AFAPI af_err | af_asinh (af_array *out, const af_array in)
| C Interface for asinh. More...
AFAPI af_err | af_acosh (af_array *out, const af_array in)
| C Interface for acosh. More...
AFAPI af_err | af_atanh (af_array *out, const af_array in)
| C Interface for atanh. More...
AFAPI af_err | af_root (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for root. More...
AFAPI af_err | af_pow (af_array *out, const af_array lhs, const af_array rhs, const bool batch)
| C Interface for power. More...
AFAPI af_err | af_pow2 (af_array *out, const af_array in)
| C Interface for power of two. More...
AFAPI af_err | af_exp (af_array *out, const af_array in)
| C Interface for exponential of an array. More...
AFAPI af_err | af_sigmoid (af_array *out, const af_array in)
| C Interface for calculating sigmoid function of an array. More...
AFAPI af_err | af_expm1 (af_array *out, const af_array in)
| C Interface for exponential of an array minus 1. More...
AFAPI af_err | af_erf (af_array *out, const af_array in)
| C Interface for error function value. More...
AFAPI af_err | af_erfc (af_array *out, const af_array in)
| C Interface for complementary error function value. More...
AFAPI af_err | af_log (af_array *out, const af_array in)
| C Interface for natural logarithm. More...
AFAPI af_err | af_log1p (af_array *out, const af_array in)
| C Interface for logarithm of (in + 1) More...
AFAPI af_err | af_log10 (af_array *out, const af_array in)
| C Interface for logarithm base 10. More...
AFAPI af_err | af_log2 (af_array *out, const af_array in)
| C Interface for logarithm base 2. More...
AFAPI af_err | af_sqrt (af_array *out, const af_array in)
| C Interface for square root. More...
AFAPI af_err | af_cbrt (af_array *out, const af_array in)
| C Interface for cube root. More...
AFAPI af_err | af_factorial (af_array *out, const af_array in)
| C Interface for the factorial. More...
AFAPI af_err | af_tgamma (af_array *out, const af_array in)
| C Interface for the gamma function. More...
AFAPI af_err | af_lgamma (af_array *out, const af_array in)
| C Interface for the logarithm of absolute values of gamma function. More...
AFAPI af_err | af_iszero (af_array *out, const af_array in)
| C Interface for checking if values are zero. More...
AFAPI af_err | af_isinf (af_array *out, const af_array in)
| C Interface for checking if values are infinities. More...
AFAPI af_err | af_isnan (af_array *out, const af_array in)
| C Interface for checking if values are NaNs. More...
AFAPI array | min (const array &lhs, const array &rhs)
| C++ interface for min of two arrays. More...
AFAPI array | min (const array &lhs, const double rhs)
| C++ interface for min of two arrays. More...
AFAPI array | min (const double lhs, const array &rhs)
| C++ interface for min of two arrays. More...
AFAPI array | max (const array &lhs, const array &rhs)
| C++ Interface for max of two arrays or an array and a scalar. More...
AFAPI array | max (const array &lhs, const double rhs)
| C++ Interface for max of two arrays or an array and a scalar. More...
AFAPI array | max (const double lhs, const array &rhs)
| C++ Interface for max of two arrays or an array and a scalar. More...
AFAPI array | clamp (const array &in, const array &lo, const array &hi)
| C++ Interface for clamping an array between two values. More...
AFAPI array | clamp (const array &in, const array &lo, const double hi)
| C++ Interface for clamping an array between two values. More...
AFAPI array | clamp (const array &in, const double lo, const array &hi)
| C++ Interface for clamping an array between two values. More...
AFAPI array | rem (const array &lhs, const array &rhs)
| C++ Interface for remainder when array divides array, scalar divides array or array divides scalar. More...
AFAPI array | rem (const array &lhs, const double rhs)
| C++ Interface for remainder when array divides array, scalar divides array or array divides scalar. More...
AFAPI array | rem (const double lhs, const array &rhs)
| C++ Interface for remainder when array divides array, scalar divides array or array divides scalar. More...
AFAPI array | mod (const array &lhs, const array &rhs)
| C++ Interface for modulus when dividend and divisor are arrays or one of them is scalar. More...
AFAPI array | mod (const array &lhs, const double rhs)
| C++ Interface for modulus when dividend and divisor are arrays or one of them is scalar. More...
AFAPI array | mod (const double lhs, const array &rhs)
| C++ Interface for modulus when dividend and divisor are arrays or one of them is scalar. More...
AFAPI array | hypot (const array &lhs, const array &rhs)
| C++ Interface for getting length of hypotenuse of two inputs. More...
AFAPI array | hypot (const array &lhs, const double rhs)
| C++ Interface for getting length of hypotenuse of two inputs. More...
AFAPI array | hypot (const double lhs, const array &rhs)
| C++ Interface for getting length of hypotenuse of two inputs. More...
AFAPI array | atan2 (const array &lhs, const array &rhs)
| C++ Interface for arc tan of two arrays. More...
AFAPI array | atan2 (const array &lhs, const double rhs)
| C++ Interface for arc tan of two arrays. More...
AFAPI array | atan2 (const double lhs, const array &rhs)
| C++ Interface for arc tan of two arrays. More...
AFAPI array | complex (const array &lhs, const array &rhs)
| C++ Interface for creating complex array from two inputs. More...
AFAPI array | complex (const array &lhs, const double rhs)
| C++ Interface for creating complex array from two inputs. More...
AFAPI array | complex (const double lhs, const array &rhs)
| C++ Interface for creating complex array from two inputs. More...
AFAPI array | complex (const array &in)
| C++ Interface for creating complex array from real array. More...
AFAPI array | pow (const array &lhs, const array &rhs)
| C++ Interface for power. More...
AFAPI array | pow (const array &lhs, const double rhs)
| C++ Interface for power. More...
AFAPI array | pow (const double lhs, const array &rhs)
| C++ Interface for power. More...
AFAPI array | pow2 (const array &in)
| C++ Interface for power of 2. More...

## Function Documentation

## § af_log2()

AFAPI af_err af_log2 | ( | af_array * | out,
|  | const af_array | in
| ) |  |

C Interface for logarithm base 2.

Parameters

  [out] | out | will contain the base 2 logarithm of `in`
  [in] | in | is input

Returns
  AF_SUCCESS if the execution completes properly

## § af_lt()

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

C Interface for checking if an array is less than another.

Parameters

  [out] | out | will contain result of `lhs` < `rhs`. out is of type b8
  [in] | lhs | first input
  [in] | rhs | second input
  [in] | batch | specifies if operations need to be performed in batch mode

Returns
  AF_SUCCESS if the execution completes properly

## § af_pow2()

AFAPI af_err af_pow2 | ( | af_array * | out,
|  | const af_array | in
| ) |  |

C Interface for power of two.

Parameters

  [out] | out | will contain the values of 2 to the power `in`
  [in] | in | is exponent

Returns
  AF_SUCCESS if the execution completes properly

## § af_sigmoid()

AFAPI af_err af_sigmoid | ( | af_array * | out,
|  | const af_array | in
| ) |  |

C Interface for calculating sigmoid function of an array.

Parameters

  [out] | out | will contain the sigmoid of `in`
  [in] | in | is input

Returns
  AF_SUCCESS if the execution completes properly