Sum array elements over a given dimension. More...
Functions | |
AFAPI array | sum (const array &in, const int dim=-1) |
C++ Interface to sum array elements over a given dimension. More... | |
AFAPI array | sum (const array &in, const int dim, const double nanval) |
C++ Interface to sum array elements over a given dimension, replacing any NaNs with a specified value. More... | |
template<typename T > | |
T | sum (const array &in) |
C++ Interface to sum array elements over all dimensions. More... | |
template<typename T > | |
T | sum (const array &in, double nanval) |
C++ Interface to sum array elements over all dimensions, replacing any NaNs with a specified value. More... | |
AFAPI af_err | af_sum (af_array *out, const af_array in, const int dim) |
C Interface to sum array elements over a given dimension. More... | |
AFAPI af_err | af_sum_all_array (af_array *out, const af_array in) |
C Interface to sum array elements over all dimensions. More... | |
AFAPI af_err | af_sum_nan (af_array *out, const af_array in, const int dim, const double nanval) |
C Interface to sum array elements over a given dimension, replacing any NaNs with a specified value. More... | |
AFAPI af_err | af_sum_nan_all_array (af_array *out, const af_array in, const double nanval) |
C Interface to sum array elements over all dimensions, replacing any NaNs with a specified value. More... | |
AFAPI af_err | af_sum_all (double *real, double *imag, const af_array in) |
C Interface to sum array elements over all dimensions. More... | |
AFAPI af_err | af_sum_nan_all (double *real, double *imag, const af_array in, const double nanval) |
C Interface to sum array elements over all dimensions, replacing any NaNs with a specified value. More... | |
Sum array elements over a given dimension.
This table defines output types for corresponding input types:
Input Type | Output Type |
---|---|
f32, f64, c32, c64 | same as input |
s32, s64, u32, u64 | same as input |
s16 | s32 |
u16, u8, b8 | u32 |
This function runs across all batches in the input simultaneously.
C Interface to sum array elements over a given dimension.
[out] | out | sum |
[in] | in | input array |
[in] | dim | dimension along which the summation occurs |
C Interface to sum array elements over all dimensions.
If in
is real, imag
will be set to zeros.
[out] | real | sum of all real components |
[out] | imag | sum of all imaginary components |
[in] | in | input array |
C Interface to sum array elements over all dimensions.
Results in a single element af::array
.
[out] | out | sum |
[in] | in | input array |
C Interface to sum array elements over a given dimension, replacing any NaNs with a specified value.
[out] | out | sum |
[in] | in | input array |
[in] | dim | dimension along which the summation occurs |
[in] | nanval | value that replaces NaNs |
AFAPI af_err af_sum_nan_all | ( | double * | real, |
double * | imag, | ||
const af_array | in, | ||
const double | nanval | ||
) |
C Interface to sum array elements over all dimensions, replacing any NaNs with a specified value.
If in
is real, imag
will be set to zeros.
[out] | real | sum of all real components |
[out] | imag | sum of all imaginary components |
[in] | in | input array |
[in] | nanval | value that replaces NaNs |
C Interface to sum array elements over all dimensions, replacing any NaNs with a specified value.
Results in a single element af::array
.
[out] | out | sum |
[in] | in | input array |
[in] | nanval | value that replaces NaNs |
T sum | ( | const array & | in | ) |
C++ Interface to sum array elements over all dimensions.
Results in a single value as an output, which may be a single element af::array
.
[in] | in | input array |
C++ Interface to sum array elements over a given dimension, replacing any NaNs with a specified value.
[in] | in | input array |
[in] | dim | dimension along which the summation occurs |
[in] | nanval | value that replaces NaNs |
C++ Interface to sum array elements over a given dimension.
[in] | in | input array |
[in] | dim | dimension along which the summation occurs, -1 denotes the first non-singleton dimension |