array | sum (const array &input, int dim=-1) |
sum of the elements along a dimension in matrix | |
template<typename ty > | |
ty | sum (const array &input) |
summation of all elements in array | |
array | prod (const array &input, int dim=-1) |
product (multiplication) of elements along a dimension in matrix | |
template<typename ty > | |
ty | prod (const array &input) |
product (multiplication) of all elements in array |
array af::sum | ( | const array & | input, |
int | dim = -1 |
||
) |
sum of the elements along a dimension in matrix
[in] | input | |
[in] | dim | dimension along which to operate (-1 indicates first nonsingleton dimension) |
dim
in the input ty af::sum | ( | const array & | input | ) |
summation of all elements in array
float hx[] = { -3, -5, 2, -9 }; array x1(hx, 2,2); // 2x2 matrix array x2(hx, 4,1); // 4x1 vector printf("%g,%g\n", sum<float>(x1), sum<float>(x2)); // -15,-15
[in] | input |
array af::prod | ( | const array & | input, |
int | dim = -1 |
||
) |
product (multiplication) of elements along a dimension in matrix
[in] | input | |
[in] | dim | dimension along which to operate (-1 indicates first nonsingleton dimension) |
dim
in the input ty af::prod | ( | const array & | input | ) |
product (multiplication) of all elements in array
float hx[] = { -3, -5, 2, -9 }; array x1(hx, 2,2); // 2x2 matrix array x2(hx, 4,1); // 4x1 vector printf("%g,%g\n", prod<float>(x1), prod<float>(x2)); // -270,-270
[in] | input |