algorithm.h File Reference
#include <af/defines.h>

Go to the source code of this file.

Namespaces

namespace  af
 

Functions

AFAPI array sum (const array &in, const int dim=-1)
 C++ Interface for sum of elements in an array. More...
 
AFAPI array sum (const array &in, const int dim, const double nanval)
 C++ Interface for sum of elements in an array while replacing nan values. More...
 
AFAPI void sumByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for sum of elements along given dimension by key. More...
 
AFAPI void sumByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim, const double nanval)
 C++ Interface for sum of elements along given dimension by key while replacing nan values. More...
 
AFAPI array product (const array &in, const int dim=-1)
 C++ Interface for product of elements in an array. More...
 
AFAPI array product (const array &in, const int dim, const double nanval)
 C++ Interface for product of elements in an array while replacing nan values. More...
 
AFAPI void productByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for product of elements in an array according to a key. More...
 
AFAPI void productByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim, const double nanval)
 C++ Interface for product of elements in an array according to a key while replacing nan values. More...
 
AFAPI array min (const array &in, const int dim=-1)
 C++ Interface for minimum values in an array. More...
 
AFAPI void minByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for minimum values in an array according to a key. More...
 
AFAPI array max (const array &in, const int dim=-1)
 C++ Interface for maximum values in an array. More...
 
AFAPI void maxByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for maximum values in an array according to a key. More...
 
AFAPI void max (array &val, array &idx, const array &in, const array &ragged_len, const int dim)
 C++ Interface for ragged max values in an array Uses an additional input array to determine the number of elements to use along the reduction axis. More...
 
AFAPI array allTrue (const array &in, const int dim=-1)
 C++ Interface for checking all true values in an array. More...
 
AFAPI void allTrueByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for checking all true values in an array according to a key. More...
 
AFAPI array anyTrue (const array &in, const int dim=-1)
 C++ Interface for checking any true values in an array. More...
 
AFAPI void anyTrueByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for checking any true values in an array according to a key. More...
 
AFAPI array count (const array &in, const int dim=-1)
 C++ Interface for counting non-zero values in an array. More...
 
AFAPI void countByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1)
 C++ Interface for counting non-zero values in an array according to a key. More...
 
template<typename T >
sum (const array &in)
 C++ Interface for sum of all elements in an array. More...
 
template<typename T >
sum (const array &in, double nanval)
 C++ Interface for sum of all elements in an array while replacing nan values. More...
 
template<typename T >
product (const array &in)
 C++ Interface for product of all elements in an array. More...
 
template<typename T >
product (const array &in, double nanval)
 C++ Interface for product of all elements in an array while replacing nan values. More...
 
template<typename T >
min (const array &in)
 C++ Interface for getting minimum value of an array. More...
 
template<typename T >
max (const array &in)
 C++ Interface for getting maximum value of an array. More...
 
template<typename T >
allTrue (const array &in)
 C++ Interface for checking if all values in an array are true. More...
 
template<typename T >
anyTrue (const array &in)
 C++ Interface for checking if any values in an array are true. More...
 
template<typename T >
count (const array &in)
 C++ Interface for counting total number of non-zero values in an array. More...
 
AFAPI void min (array &val, array &idx, const array &in, const int dim=-1)
 C++ Interface for getting minimum values and their locations in an array. More...
 
AFAPI void max (array &val, array &idx, const array &in, const int dim=-1)
 C++ Interface for getting maximum values and their locations in an array. More...
 
template<typename T >
void min (T *val, unsigned *idx, const array &in)
 C++ Interface for getting minimum value and its location from the entire array. More...
 
template<typename T >
void max (T *val, unsigned *idx, const array &in)
 C++ Interface for getting maximum value and its location from the entire array. More...
 
AFAPI array accum (const array &in, const int dim=0)
 C++ Interface for computing the cumulative sum (inclusive) of an array. More...
 
AFAPI array scan (const array &in, const int dim=0, binaryOp op=AF_BINARY_ADD, bool inclusive_scan=true)
 C++ Interface generalized scan of an array. More...
 
AFAPI array scanByKey (const array &key, const array &in, const int dim=0, binaryOp op=AF_BINARY_ADD, bool inclusive_scan=true)
 C++ Interface generalized scan by key of an array. More...
 
AFAPI array where (const array &in)
 C++ Interface for finding the locations of non-zero values in an array. More...
 
AFAPI array diff1 (const array &in, const int dim=0)
 C++ Interface for calculating first order differences in an array. More...
 
AFAPI array diff2 (const array &in, const int dim=0)
 C++ Interface for calculating second order differences in an array. More...
 
AFAPI array sort (const array &in, const unsigned dim=0, const bool isAscending=true)
 C++ Interface for sorting an array. More...
 
AFAPI void sort (array &out, array &indices, const array &in, const unsigned dim=0, const bool isAscending=true)
 C++ Interface for sorting an array and getting original indices. More...
 
AFAPI void sort (array &out_keys, array &out_values, const array &keys, const array &values, const unsigned dim=0, const bool isAscending=true)
 C++ Interface for sorting an array based on keys. More...
 
AFAPI array setUnique (const array &in, const bool is_sorted=false)
 C++ Interface for getting unique values. More...
 
AFAPI array setUnion (const array &first, const array &second, const bool is_unique=false)
 C++ Interface for finding the union of two arrays. More...
 
AFAPI array setIntersect (const array &first, const array &second, const bool is_unique=false)
 C++ Interface for finding the intersection of two arrays. More...
 
AFAPI af_err af_sum (af_array *out, const af_array in, const int dim)
 C Interface for sum of elements in an array. More...
 
AFAPI af_err af_sum_nan (af_array *out, const af_array in, const int dim, const double nanval)
 C Interface for sum of elements in an array while replacing nans. More...
 
AFAPI af_err af_sum_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for sum of elements in an array according to key. More...
 
AFAPI af_err af_sum_by_key_nan (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim, const double nanval)
 C Interface for sum of elements in an array according to key while replacing nans. More...
 
AFAPI af_err af_product (af_array *out, const af_array in, const int dim)
 C Interface for product of elements in an array. More...
 
AFAPI af_err af_product_nan (af_array *out, const af_array in, const int dim, const double nanval)
 C Interface for product of elements in an array while replacing nans. More...
 
AFAPI af_err af_product_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for product of elements in an array according to key. More...
 
AFAPI af_err af_product_by_key_nan (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim, const double nanval)
 C Interface for product of elements in an array according to key while replacing nans. More...
 
AFAPI af_err af_min (af_array *out, const af_array in, const int dim)
 C Interface for minimum values in an array. More...
 
AFAPI af_err af_min_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for minimum values in an array according to key. More...
 
AFAPI af_err af_max (af_array *out, const af_array in, const int dim)
 C Interface for maximum values in an array. More...
 
AFAPI af_err af_max_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for maximum values in an array according to key. More...
 
AFAPI af_err af_max_ragged (af_array *val, af_array *idx, const af_array in, const af_array ragged_len, const int dim)
 C Interface for finding ragged max values in an array Uses an additional input array to determine the number of elements to use along the reduction axis. More...
 
AFAPI af_err af_all_true (af_array *out, const af_array in, const int dim)
 C Interface for checking all true values in an array. More...
 
AFAPI af_err af_all_true_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for checking all true values in an array according to key. More...
 
AFAPI af_err af_any_true (af_array *out, const af_array in, const int dim)
 C Interface for checking any true values in an array. More...
 
AFAPI af_err af_any_true_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for checking any true values in an array according to key. More...
 
AFAPI af_err af_count (af_array *out, const af_array in, const int dim)
 C Interface for counting non-zero values in an array. More...
 
AFAPI af_err af_count_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim)
 C Interface for counting non-zero values in an array according to key. More...
 
AFAPI af_err af_sum_all (double *real, double *imag, const af_array in)
 C Interface for sum of all elements in an array. More...
 
AFAPI af_err af_sum_nan_all (double *real, double *imag, const af_array in, const double nanval)
 C Interface for sum of all elements in an array while replacing nans. More...
 
AFAPI af_err af_product_all (double *real, double *imag, const af_array in)
 C Interface for product of all elements in an array. More...
 
AFAPI af_err af_product_nan_all (double *real, double *imag, const af_array in, const double nanval)
 C Interface for product of all elements in an array while replacing nans. More...
 
AFAPI af_err af_min_all (double *real, double *imag, const af_array in)
 C Interface for getting minimum value of an array. More...
 
AFAPI af_err af_max_all (double *real, double *imag, const af_array in)
 C Interface for getting maximum value of an array. More...
 
AFAPI af_err af_all_true_all (double *real, double *imag, const af_array in)
 C Interface for checking if all values in an array are true. More...
 
AFAPI af_err af_any_true_all (double *real, double *imag, const af_array in)
 C Interface for checking if any values in an array are true. More...
 
AFAPI af_err af_count_all (double *real, double *imag, const af_array in)
 C Interface for counting total number of non-zero values in an array. More...
 
AFAPI af_err af_imin (af_array *out, af_array *idx, const af_array in, const int dim)
 C Interface for getting minimum values and their locations in an array. More...
 
AFAPI af_err af_imax (af_array *out, af_array *idx, const af_array in, const int dim)
 C Interface for getting maximum values and their locations in an array. More...
 
AFAPI af_err af_imin_all (double *real, double *imag, unsigned *idx, const af_array in)
 C Interface for getting minimum value and its location from the entire array. More...
 
AFAPI af_err af_imax_all (double *real, double *imag, unsigned *idx, const af_array in)
 C Interface for getting maximum value and it's location from the entire array. More...
 
AFAPI af_err af_accum (af_array *out, const af_array in, const int dim)
 C Interface for computing the cumulative sum (inclusive) of an array. More...
 
AFAPI af_err af_scan (af_array *out, const af_array in, const int dim, af_binary_op op, bool inclusive_scan)
 C Interface generalized scan of an array. More...
 
AFAPI af_err af_scan_by_key (af_array *out, const af_array key, const af_array in, const int dim, af_binary_op op, bool inclusive_scan)
 C Interface generalized scan by key of an array. More...
 
AFAPI af_err af_where (af_array *idx, const af_array in)
 C Interface for finding the locations of non-zero values in an array. More...
 
AFAPI af_err af_diff1 (af_array *out, const af_array in, const int dim)
 C Interface for calculating first order differences in an array. More...
 
AFAPI af_err af_diff2 (af_array *out, const af_array in, const int dim)
 C Interface for calculating second order differences in an array. More...
 
AFAPI af_err af_sort (af_array *out, const af_array in, const unsigned dim, const bool isAscending)
 C Interface for sorting an array. More...
 
AFAPI af_err af_sort_index (af_array *out, af_array *indices, const af_array in, const unsigned dim, const bool isAscending)
 C Interface for sorting an array and getting original indices. More...
 
AFAPI af_err af_sort_by_key (af_array *out_keys, af_array *out_values, const af_array keys, const af_array values, const unsigned dim, const bool isAscending)
 C Interface for sorting an array based on keys. More...
 
AFAPI af_err af_set_unique (af_array *out, const af_array in, const bool is_sorted)
 C Interface for getting unique values. More...
 
AFAPI af_err af_set_union (af_array *out, const af_array first, const af_array second, const bool is_unique)
 C Interface for finding the union of two arrays. More...
 
AFAPI af_err af_set_intersect (af_array *out, const af_array first, const af_array second, const bool is_unique)
 C Interface for finding the intersection of two arrays. More...
 

Function Documentation

◆ af_all_true_by_key()

AFAPI af_err af_all_true_by_key ( af_array keys_out,
af_array vals_out,
const af_array  keys,
const af_array  vals,
const int  dim 
)

C Interface for checking all true values in an array according to key.

Parameters
[out]keys_outwill contain the reduced keys in vals along dim
[out]vals_outwill contain the the reduced and of all values in vals along dim according to keys
[in]keysis the key array
[in]valsis the array containing the values to be reduced
[in]dimThe dimension along which the "and" operation occurs
Returns
AF_SUCCESS if the execution completes properly