Do more. Code less. Free software for GPU computing.
<scroll to top>

Statistics: average, median, variance, histogram, etc.

Data Analysis

array avg (const array &input, int dim=-1)
 average along a dimension
template<typename ty >
ty avg (const array &input)
 average of all elements in array
array var (const array &input, bool isbiased=false, int dim=-1)
 variance along a dimension
array var (const array &input, const array weights, int dim=-1)
 weighted variance along a dimension
template<typename ty >
ty var (const array &input, bool isbiased=false)
 variance of all elements in array
template<typename ty >
ty var (const array &input, const array weights)
 weighted variance of all elements in array
array cov (const array &input, bool isbiased=false)
 covariance of row observations
array cov (const array &X, const array &Y, bool isbiased=false)
 covariance between two jointly distributed random variables
array std (const array &in, bool isbiased=false, int dim=-1)
 standard deviation along a dimension.
template<typename ty >
ty std (const array &input, bool isbiased=false)
 standard deviation of all elements in a vector.
array median (const array &input, int dim=-1)
 median along a dimension
template<typename ty >
ty median (const array &input)
 median of all elements in array
template<typename ty >
ty corrcoef (const array &x, const array &y)
 Correlation coefficient between vectors x and y.

Function Documentation

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

average along a dimension

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
array with mean values along the dimension dim in the input
ty af::avg ( const array &  input)

average of all elements in array

Parameters:
[in]input
Returns:
average of all elements in array
array af::var ( const array &  input,
bool  isbiased = false,
int  dim = -1 
)

variance along a dimension

Parameters:
[in]input
[in]isbiasedif true then use sample variance (N); otherwise if false (default) use population variance (N - 1) where N=input.elements()
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
array af::var ( const array &  input,
const array  weights,
int  dim = -1 
)

weighted variance along a dimension

Parameters:
[in]input
[in]weightsplaced on each element (same size as input)
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
variance using nonnegative weights instead of unit weight
ty af::var ( const array &  input,
bool  isbiased = false 
)

variance of all elements in array

Parameters:
[in]input
[in]isbiasedif true then use sample variance (N); otherwise if false (default) use population variance (N - 1) where N=input.elements()
ty af::var ( const array &  input,
const array  weights 
)

weighted variance of all elements in array

Parameters:
[in]input
[in]weightsplaced on each element (same size as input)
array af::cov ( const array &  input,
bool  isbiased = false 
)

covariance of row observations

Parameters:
[in]inputrows are observations, columns are variables
[in]isbiasedif true then use sample variance (N); otherwise if false (default) use population variance (N - 1) where N=input.elements()
Returns:
covariance
array af::cov ( const array &  X,
const array &  Y,
bool  isbiased = false 
)

covariance between two jointly distributed random variables

Parameters:
[in]X
[in]Y
[in]isbiasedif true then use sample variance (N); otherwise if false (default) use population variance (N - 1) where N=input.elements()
array af::std ( const array &  in,
bool  isbiased = false,
int  dim = -1 
)

standard deviation along a dimension.

Parameters:
[in]inThe input matrix
[in]isbiasedif true then use sample variance (N); otherwise if false (default) use population variance (N - 1) where N=input.elements()
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
The standard deviation of values along the dimension dim in the input
ty af::std ( const array &  input,
bool  isbiased = false 
)

standard deviation of all elements in a vector.

Parameters:
[in]input
[in]isbiasedif true then use sample variance (N); otherwise if false (default) use population variance (N - 1) where N=input.elements()
Returns:
The standard deviation of all values in the input
array af::median ( const array &  input,
int  dim = -1 
)

median along a dimension

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
The median of values along the dimension dim in the input
ty af::median ( const array &  input)

median of all elements in array

Parameters:
[in]input
Returns:
median of all elements
ty af::corrcoef ( const array &  x,
const array &  y 
)

Correlation coefficient between vectors x and y.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines