The C++ interface for mul.
More...
| array | mul (const array &input, int dim=-1) |
| |
| template<typename ty > |
| ty | mul (const array &input) |
| |
The C++ interface for mul.
The first mul function computes the product of elements
of the array along a particular dimension. This function
returns an array that is the size of the dimension specified
by the parameter.
float x[] = {5,1,7,3,2,5};
array input(2,3,x);
array output =
mul(input);
array output =
mul(input, 1);
The second mul function computes the product of all values of an array and returns the product to host memory.
float hx[] = { -3, -5, 2, -9 };
array x1(2,2, hx);
array x2(4,1, hx);
printf("%g,%g\n", mul<float>(x1), mul<float>(x2));
| array af::mul |
( |
const array & |
input, |
|
|
int |
dim = -1 |
|
) |
| |
| ty af::mul |
( |
const array & |
input | ) |
|
- Parameters
-
- Returns
- multiplication of all values in the input array