The C++ interface for alltrue. More...

array alltrue (const array &input, int dim=-1)
 Test if all elements are true (nonzero) along a dimension in input. More...
 
template<typename ty >
ty alltrue (const array &input)
 Test if all elements are true (nonzero) in entire array. More...
 

Detailed Description

The C++ interface for alltrue.

Performs a logical boolean and operation over the elements
of an array.

These functions are particularly useful when utilized with
the result of conditions as parameters. In such a case, the
input array to the function is a boolean array.

Similar to the other reduction operations in ArrayFire,
alltrue can also operate a long a given dimension.
bool hx[] = { true, true, false, true };
array x1(4, 1, hx); // 4x1 vector
printf("%d\n", alltrue<bool>(x1)); // 0

Function Documentation

array af::alltrue ( const array &  input,
int  dim = -1 
)

Test if all elements are true (nonzero) along a dimension in input.

Parameters
[in]input
[in]dimdimension along which to operate (-1 indicates first non-singleton dimension)
Returns
boolean array with test results along the dimension dim in the input
ty af::alltrue ( const array &  input)

Test if all elements are true (nonzero) in entire array.

Parameters
[in]input
Returns
true iff all elements in array are true (false if anytrue zeros)