arith.h (2022-02-24 14:07:56 -0500, (build 8c2561559))
Go to the documentation of this file.
1/*******************************************************
2 * Copyright (c) 2014, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10#include <af/defines.h>
11
12#ifdef __cplusplus
13namespace af
14{
15 class array;
16
25 AFAPI array min (const array &lhs, const array &rhs);
26
28 AFAPI array min (const array &lhs, const double rhs);
29
31 AFAPI array min (const double lhs, const array &rhs);
33
41 AFAPI array max (const array &lhs, const array &rhs);
42
44 AFAPI array max (const array &lhs, const double rhs);
45
47 AFAPI array max (const double lhs, const array &rhs);
49
50#if AF_API_VERSION >= 34
59 AFAPI array clamp(const array &in, const array &lo, const array &hi);
60#endif
61
62#if AF_API_VERSION >= 34
64 AFAPI array clamp(const array &in, const array &lo, const double hi);
65#endif
66
67#if AF_API_VERSION >= 34
69 AFAPI array clamp(const array &in, const double lo, const array &hi);
70#endif
71
72#if AF_API_VERSION >= 34
74 AFAPI array clamp(const array &in, const double lo, const double hi);
75#endif
77
86 AFAPI array rem (const array &lhs, const array &rhs);
87
89 AFAPI array rem (const array &lhs, const double rhs);
90
92 AFAPI array rem (const double lhs, const array &rhs);
94
103 AFAPI array mod (const array &lhs, const array &rhs);
104
106 AFAPI array mod (const array &lhs, const double rhs);
107
109 AFAPI array mod (const double lhs, const array &rhs);
111
118 AFAPI array abs (const array &in);
119
128 AFAPI array arg (const array &in);
129
140 AFAPI array sign (const array &in);
141
150 AFAPI array round (const array &in);
151
160 AFAPI array trunc (const array &in);
161
162
169 AFAPI array floor (const array &in);
170
177 AFAPI array ceil (const array &in);
178
189 AFAPI array hypot (const array &lhs, const array &rhs);
190
192 AFAPI array hypot (const array &lhs, const double rhs);
193
195 AFAPI array hypot (const double lhs, const array &rhs);
197
204 AFAPI array sin (const array &in);
205
212 AFAPI array cos (const array &in);
213
220 AFAPI array tan (const array &in);
221
228 AFAPI array asin (const array &in);
229
236 AFAPI array acos (const array &in);
237
244 AFAPI array atan (const array &in);
245
253 AFAPI array atan2 (const array &lhs, const array &rhs);
254
256 AFAPI array atan2 (const array &lhs, const double rhs);
257
259 AFAPI array atan2 (const double lhs, const array &rhs);
261
275 AFAPI array complex(const array &real, const array &imaginary);
276
279 AFAPI array complex(const array &real, const double imaginary);
280
283 AFAPI array complex(const double real, const array &imaginary);
284
293
300 AFAPI array real (const array &in);
301
308 AFAPI array imag (const array &in);
309
316 AFAPI array conjg (const array &in);
317
324 AFAPI array sinh (const array &in);
325
332 AFAPI array cosh (const array &in);
333
340 AFAPI array tanh (const array &in);
341
348 AFAPI array asinh (const array &in);
349
356 AFAPI array acosh (const array &in);
357
364 AFAPI array atanh (const array &in);
365
373 AFAPI array root (const array &lhs, const array &rhs);
374
382 AFAPI array root (const array &lhs, const double rhs);
383
391 AFAPI array root (const double lhs, const array &rhs);
392
393
404 AFAPI array pow (const array &lhs, const array &rhs);
405
407 AFAPI array pow (const array &lhs, const double rhs);
408
410 AFAPI array pow (const double lhs, const array &rhs);
411
417 AFAPI array pow2 (const array &in);
419
420#if AF_API_VERSION >= 31
428#endif
429
436 AFAPI array exp (const array &in);
437
445 AFAPI array expm1 (const array &in);
446
453 AFAPI array erf (const array &in);
454
461 AFAPI array erfc (const array &in);
462
469 AFAPI array log (const array &in);
470
478 AFAPI array log1p (const array &in);
479
486 AFAPI array log10 (const array &in);
487
494 AFAPI array log2 (const array &in);
495
502 AFAPI array sqrt (const array &in);
503
504#if AF_API_VERSION >= 37
511 AFAPI array rsqrt (const array &in);
512#endif
513
520 AFAPI array cbrt (const array &in);
521
530
537 AFAPI array tgamma (const array &in);
538
545 AFAPI array lgamma (const array &in);
546
553 AFAPI array iszero (const array &in);
554
561 AFAPI array isInf (const array &in);
562
569 AFAPI array isNaN (const array &in);
570}
571#endif
572
573#ifdef __cplusplus
574extern "C" {
575#endif
576
588 AFAPI af_err af_add (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
589
601 AFAPI af_err af_sub (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
602
614 AFAPI af_err af_mul (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
615
627 AFAPI af_err af_div (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
628
640 AFAPI af_err af_lt (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
641
653 AFAPI af_err af_gt (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
654
666 AFAPI af_err af_le (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
667
679 AFAPI af_err af_ge (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
680
692 AFAPI af_err af_eq (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
693
705 AFAPI af_err af_neq (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
706
718 AFAPI af_err af_and (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
719
731 AFAPI af_err af_or (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
732
743
744#if AF_API_VERSION >= 38
755#endif
756
768 AFAPI af_err af_bitand (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
769
781 AFAPI af_err af_bitor (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
782
794 AFAPI af_err af_bitxor (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
795
807 AFAPI af_err af_bitshiftl(af_array *out, const af_array lhs, const af_array rhs, const bool batch);
808
820 AFAPI af_err af_bitshiftr(af_array *out, const af_array lhs, const af_array rhs, const bool batch);
821
832 AFAPI af_err af_cast (af_array *out, const af_array in, const af_dtype type);
833
845 AFAPI af_err af_minof (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
846
858 AFAPI af_err af_maxof (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
859
860#if AF_API_VERSION >= 34
874 const af_array lo, const af_array hi, const bool batch);
875#endif
876
888 AFAPI af_err af_rem (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
889
901 AFAPI af_err af_mod (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
902
913
924
937
950
961
972
983
995 AFAPI af_err af_hypot (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
996
1007
1018
1029
1040
1051
1062
1074 AFAPI af_err af_atan2 (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
1075
1087 AFAPI af_err af_cplx2 (af_array *out, const af_array real, const af_array imaginary, const bool batch);
1088
1099
1110
1121
1132
1143
1154
1165
1176
1187
1198
1210 AFAPI af_err af_root (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
1211
1212
1224 AFAPI af_err af_pow (af_array *out, const af_array lhs, const af_array rhs, const bool batch);
1225
1236
1247
1248#if AF_API_VERSION >= 31
1259#endif
1260
1271
1282
1293
1304
1315
1326
1337
1348
1349#if AF_API_VERSION >= 37
1360#endif
1371
1382
1393
1404
1415
1426
1437
1438#ifdef __cplusplus
1439}
1440#endif
AFAPI af_err af_log2(af_array *out, const af_array in)
C Interface for logarithm base 2.
AFAPI af_err af_pow2(af_array *out, const af_array in)
C Interface for power of two.
AFAPI af_err af_sigmoid(af_array *out, const af_array in)
C Interface for calculating sigmoid function of an array.
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.
A multi dimensional data container.
Definition: array.h:37
af_dtype
Definition: defines.h:210
af_err
Definition: defines.h:71
void * af_array
Definition: defines.h:240
#define AFAPI
Definition: defines.h:38
AFAPI array abs(const array &in)
C++ Interface for absolute value.
AFAPI af_err af_abs(af_array *out, const af_array in)
C Interface for absolute value.
AFAPI af_err af_acos(af_array *out, const af_array in)
C Interface for arc cos.
AFAPI array acos(const array &in)
C++ Interface for arc cos (cos inverse)
AFAPI array acosh(const array &in)
C++ Interface for cosh inverse.
AFAPI af_err af_acosh(af_array *out, const af_array in)
C Interface for acosh.
AFAPI af_err af_add(af_array *out, const af_array lhs, const af_array rhs, const bool batch)
C Interface for adding arrays.
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.
AFAPI array arg(const array &in)
C++ Interface for arg.
AFAPI af_err af_arg(af_array *out, const af_array in)
C Interface for finding the phase.
AFAPI af_err af_asin(af_array *out, const af_array in)
C Interface for arc sin.
AFAPI array asin(const array &in)
C++ Interface for arc sin (sin inverse)
AFAPI af_err af_asinh(af_array *out, const af_array in)
C Interface for asinh.
AFAPI array asinh(const array &in)
C++ Interface for sinh inverse.
AFAPI array atan(const array &in)
C++ Interface for arc tan (tan inverse)
AFAPI af_err af_atan(af_array *out, const af_array in)
C Interface for arc tan.
AFAPI array atan2(const array &lhs, const array &rhs)
C++ Interface for arc tan of two arrays.
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.
AFAPI af_err af_atanh(af_array *out, const af_array in)
C Interface for atanh.
AFAPI array atanh(const array &in)
C++ Interface for tanh inverse.
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.
AFAPI af_err af_bitnot(af_array *out, const af_array in)
C Interface for performing bitwise not on input.
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.
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.
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.
AFAPI array cbrt(const array &in)
C++ Interface for cube root of input.
AFAPI af_err af_cbrt(af_array *out, const af_array in)
C Interface for cube root.
AFAPI array ceil(const array &in)
C++ Interface for ceiling an array of numbers.
AFAPI af_err af_ceil(af_array *out, const af_array in)
C Interface for ceiling an array of numbers.
AFAPI array conjg(const array &in)
C++ Interface for getting the complex conjugate of input array.
AFAPI af_err af_conjg(af_array *out, const af_array in)
C Interface for getting the complex conjugate of input array.
AFAPI array cos(const array &in)
C++ Interface for cos.
AFAPI af_err af_cos(af_array *out, const af_array in)
C Interface for cos.
AFAPI array cosh(const array &in)
C++ Interface for cosh.
AFAPI af_err af_cosh(af_array *out, const af_array in)
C Interface for cosh.
AFAPI af_err af_cplx2(af_array *out, const af_array real, const af_array imaginary, const bool batch)
C Interface for creating complex array from two input arrays.
AFAPI af_err af_cplx(af_array *out, const af_array in)
C Interface for creating complex array from real array.
AFAPI array complex(const array &real, const array &imaginary)
C++ Interface for creating complex array from two inputs.
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.
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.
AFAPI array erf(const array &in)
C++ Interface for error function value.
AFAPI af_err af_erf(af_array *out, const af_array in)
C Interface for error function value.
AFAPI af_err af_erfc(af_array *out, const af_array in)
C Interface for complementary error function value.
AFAPI array erfc(const array &in)
C++ Interface for complementary error function value.
AFAPI af_err af_exp(af_array *out, const af_array in)
C Interface for exponential of an array.
AFAPI array exp(const array &in)
C++ Interface for exponential of an array.
AFAPI af_err af_expm1(af_array *out, const af_array in)
C Interface for exponential of an array minus 1.
AFAPI array expm1(const array &in)
C++ Interface for exponential of an array minus 1.
AFAPI array factorial(const array &in)
C++ Interface for factorial of input.
AFAPI af_err af_factorial(af_array *out, const af_array in)
C Interface for the factorial.
AFAPI array floor(const array &in)
C++ Interface for flooring an array of numbers.
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.
AFAPI af_err af_floor(af_array *out, const af_array in)
C Interface for flooring an array of numbers.
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.
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.
AFAPI array hypot(const array &lhs, const array &rhs)
C++ Interface for getting length of hypotenuse of two inputs.
AFAPI af_err af_imag(af_array *out, const af_array in)
C Interface for getting imaginary part from complex array.
AFAPI array imag(const array &in)
C++ Interface for getting imaginary part from complex array.
AFAPI array isInf(const array &in)
C++ Interface for checking if values are Infinities.
AFAPI af_err af_isinf(af_array *out, const af_array in)
C Interface for checking if values are infinities.
AFAPI af_err af_isnan(af_array *out, const af_array in)
C Interface for checking if values are NaNs.
AFAPI array isNaN(const array &in)
C++ Interface for checking if values are NaNs.
AFAPI array iszero(const array &in)
C++ Interface for checking if values are zero.
AFAPI af_err af_iszero(af_array *out, const af_array in)
C Interface for checking if values are zero.
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.
AFAPI af_err af_lgamma(af_array *out, const af_array in)
C Interface for the logarithm of absolute values of gamma function.
AFAPI af_err af_log10(af_array *out, const af_array in)
C Interface for logarithm base 10.
AFAPI array log10(const array &in)
C++ Interface for logarithm base 10.
AFAPI array log1p(const array &in)
C++ Interface for natural logarithm of 1 + input.
AFAPI af_err af_log1p(af_array *out, const af_array in)
C Interface for logarithm of (in + 1)
AFAPI af_err af_log(af_array *out, const af_array in)
C Interface for natural logarithm.
AFAPI array log(const array &in)
C++ Interface for natural logarithm.
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.
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.
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.
AFAPI af_err af_mod(af_array *out, const af_array lhs, const af_array rhs, const bool batch)
C Interface for modulus.
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.
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.
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.
AFAPI af_err af_not(af_array *out, const af_array in)
C Interface for performing logical not on input.
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.
AFAPI af_err af_pow(af_array *out, const af_array lhs, const af_array rhs, const bool batch)
C Interface for power.
AFAPI array pow(const array &lhs, const array &rhs)
C++ Interface for power.
AFAPI array pow2(const array &in)
C++ Interface for power of 2.
AFAPI array real(const array &in)
C++ Interface for getting real part from complex array.
AFAPI af_err af_real(af_array *out, const af_array in)
C Interface for getting real part from complex array.
AFAPI af_err af_rem(af_array *out, const af_array lhs, const af_array rhs, const bool batch)
C Interface for remainder.
AFAPI array rem(const array &lhs, const array &rhs)
C++ Interface for remainder when array divides array, scalar divides array or array divides scalar.
AFAPI af_err af_root(af_array *out, const af_array lhs, const af_array rhs, const bool batch)
C Interface for root.
AFAPI array root(const array &lhs, const array &rhs)
C++ Interface for nth root.
AFAPI af_err af_sign(af_array *out, const af_array in)
C Interface for finding the sign of the input.
AFAPI af_err af_round(af_array *out, const af_array in)
C Interface for rounding an array of numbers.
AFAPI array round(const array &in)
C++ Interface for rounding an array of numbers.
AFAPI array rsqrt(const array &in)
C++ Interface for reciprocal square root of input.
AFAPI af_err af_rsqrt(af_array *out, const af_array in)
C Interface for reciprocal square root.
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.
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.
AFAPI array sign(const array &in)
C++ Interface for getting the sign of input.
AFAPI af_err af_sin(af_array *out, const af_array in)
C Interface for sin.
AFAPI array sin(const array &in)
C++ Interface for sin.
AFAPI array sinh(const array &in)
C++ Interface for sinh.
AFAPI af_err af_sinh(af_array *out, const af_array in)
C Interface for sinh.
AFAPI array sqrt(const array &in)
C++ Interface for square root of input.
AFAPI af_err af_sqrt(af_array *out, const af_array in)
C Interface for square root.
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.
AFAPI array tan(const array &in)
C++ Interface for tan.
AFAPI af_err af_tan(af_array *out, const af_array in)
C Interface for tan.
AFAPI array tanh(const array &in)
C++ Interface for tanh.
AFAPI af_err af_tanh(af_array *out, const af_array in)
C Interface for tanh.
AFAPI array lgamma(const array &in)
C++ Interface for logarithm of absolute value of gamma function of input.
AFAPI af_err af_tgamma(af_array *out, const af_array in)
C Interface for the gamma function.
AFAPI array tgamma(const array &in)
C++ Interface for gamma function of input.
AFAPI array trunc(const array &in)
C++ Interface for truncating an array of numbers.
AFAPI af_err af_trunc(af_array *out, const af_array in)
C Interface for truncating an array of numbers.
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
AFAPI array max(const array &in, const int dim=-1)
C++ Interface for maximum values in an array.
AFAPI array min(const array &in, const int dim=-1)
C++ Interface for minimum values in an array.
Definition: algorithm.h:15
AFAPI array clamp(const array &in, const array &lo, const array &hi)
C++ Interface for clamping an array between two values.
AFAPI array log2(const array &in)
C++ Interface for logarithm base 2.
AFAPI array sigmoid(const array &in)
C++ Interface for calculating sigmoid function of an array.