A high-performance general-purpose compute library

Count non-zero values in an array along a given dimension. More...

Functions

array count (const array &in, const int dim=-1)
 C++ Interface to count non-zero values in an array along a given dimension.
 
template<typename T >
count (const array &in)
 C++ Interface to count non-zero values along the first non-singleton dimension.
 
af_err af_count (af_array *out, const af_array in, const int dim)
 C Interface to count non-zero values in an array along a given dimension.
 
af_err af_count_all (double *real, double *imag, const af_array in)
 C Interface to count non-zero values over all dimensions.
 
af_err af_count_all_array (af_array *out, const af_array in)
 C Interface to count non-zero values over all dimensions.
 

Detailed Description

Count non-zero values in an array along a given dimension.

The output type is u32.

This function runs across all batches in the input simultaneously.

Function Documentation

◆ af_count()

af_err af_count ( af_array * out,
const af_array in,
const int dim )

C Interface to count non-zero values in an array along a given dimension.

NaN values are treated as non-zero.

Parameters
[out]outcount
[in]ininput array
[in]dimdimension along which the count occurs
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_count_all()

af_err af_count_all ( double * real,
double * imag,
const af_array in )

C Interface to count non-zero values over all dimensions.

Parameters
[out]realcount
[out]imag0
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_count_all_array()

af_err af_count_all_array ( af_array * out,
const af_array in )

C Interface to count non-zero values over all dimensions.

Parameters
[out]outcount
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ count() [1/2]

template<typename T >
T count ( const array & in)

C++ Interface to count non-zero values along the first non-singleton dimension.

NaN values are treated as non-zero.

Parameters
[in]ininput array
Returns
count

◆ count() [2/2]

array count ( const array & in,
const int dim = -1 )

C++ Interface to count non-zero values in an array along a given dimension.

NaN values are treated as non-zero.

Parameters
[in]ininput array
[in]dimdimension along which the count occurs, -1 denotes the first non-singleton dimension
Returns
count