Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/af/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,9 @@ typedef enum {

#if AF_API_VERSION >= 37
typedef enum {
AF_VARIANCE_DEFAULT = 0, ///< Default (Population) variance
AF_VARIANCE_SAMPLE = 1, ///< Sample variance
AF_VARIANCE_POPULATION = 2 ///< Population variance
AF_VARIANCE_DEFAULT = 0, ///< Default (Population) variance
AF_VARIANCE_SAMPLE = 1, ///< Sample variance
AF_VARIANCE_POPULATION = 2 ///< Population variance
} af_var_bias;

typedef enum {
Expand Down
225 changes: 215 additions & 10 deletions include/af/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,37 @@ AFAPI array mean(const array& in, const array& weights, const dim_t dim=-1);
C++ Interface for variance

\param[in] in is the input array
\param[in] isbiased is boolean denoting Population variance (false) or Sample Variance (true)
\param[in] isbiased is boolean denoting Population variance (false) or Sample
Variance (true)
\param[in] dim the dimension along which the variance is extracted
\return the variance of the input array along dimension \p dim
\return the variance of the input array along dimension \p dim

\ingroup stat_func_var

\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.

\deprecated Use \ref af::var that takes \ref af_var_bias instead
*/
AF_DEPRECATED("Use \ref af::var(const array&, const af_var_bias, const dim_t)")
AFAPI array var(const array& in, const bool isbiased=false, const dim_t dim=-1);

#if AF_API_VERSION >= 38
/**
C++ Interface for variance

\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes o
value of type \ref af_var_bias.
\param[in] dim the dimension along which the variance is extracted
\return the variance of the input array along dimension \p dim

\ingroup stat_func_var

\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
*/
AFAPI array var(const array &in, const af_var_bias bias, const dim_t dim = -1);
#endif

/**
C++ Interface for variance of weighted inputs

Expand Down Expand Up @@ -97,22 +118,61 @@ AFAPI void meanvar(array& mean, array& var, const array& in, const array& weight
\ingroup stat_func_stdev

\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.

\deprecated Use \ref af::stdev that takes \ref af_var_bias instead
*/
AF_DEPRECATED("Use af::stdev(const array&, const af_var_bias, const dim_t)")
AFAPI array stdev(const array& in, const dim_t dim=-1);

#if AF_API_VERSION >= 38
/**
C++ Interface for standard deviation

\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias.
\param[in] dim the dimension along which the standard deviation is extracted
\return the standard deviation of the input array along dimension \p dim

\ingroup stat_func_stdev

\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
*/
AFAPI array stdev(const array &in, const af_var_bias bias,
const dim_t dim = -1);
#endif

/**
C++ Interface for covariance

\param[in] X is the first input array
\param[in] Y is the second input array
\param[in] isbiased is boolean specifying if biased estimate should be taken (default: false)
\param[in] isbiased is boolean specifying if biased estimate should be
taken (default: false)
\return the covariance of the input arrays

\ingroup stat_func_cov

\deprecated Use af::cov(const array&, const array& const af_var_bias)
*/
AF_DEPRECATED("Use af::cov(const af::array&, const array&, conv af_var_bias)")
AFAPI array cov(const array& X, const array& Y, const bool isbiased=false);

#if AF_API_VERSION >= 38
/**
C++ Interface for covariance

\param[in] X is the first input array
\param[in] Y is the second input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias.
\return the covariance of the input arrays

\ingroup stat_func_cov
*/
AFAPI array cov(const array &X, const array &Y, const af_var_bias bias);
#endif

/**
C++ Interface for median

Expand Down Expand Up @@ -153,13 +213,31 @@ AFAPI T mean(const array& in, const array& weights);
C++ Interface for variance of all elements

\param[in] in is the input array
\param[in] isbiased is boolean denoting Population variance (false) or Sample Variance (true)
\return variance of the entire input array
\param[in] isbiased is boolean denoting Population variance (false) or Sample
Variance (true)
\return variance of the entire input array

\ingroup stat_func_var

\deprecated Use \ref af::var that takes \ref af_var_bias instead
*/
template<typename T>
AFAPI T var(const array& in, const bool isbiased=false);
template <typename T>
AF_DEPRECATED("Use af::var(const af::array&, const af_var_bias)")
AFAPI T var(const array &in, const bool isbiased = false);

#if AF_API_VERSION >= 38
/**
C++ Interface for variance of all elements

\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias.
\return variance of the \p in array

\ingroup stat_func_var
*/
template <typename T> AFAPI T var(const array &in, const af_var_bias bias);
#endif

/**
C++ Interface for variance of all elements in weighted input
Expand All @@ -180,9 +258,26 @@ AFAPI T var(const array& in, const array& weights);
\return standard deviation of the entire input array

\ingroup stat_func_stdev

\deprecated Use \ref af::stdev that takes \ref af_var_bias instead
*/
template<typename T>
AFAPI T stdev(const array& in);
template <typename T>
AF_DEPRECATED("Use af::stdev(const array&, const af_var_bias)")
AFAPI T stdev(const array &in);

#if AF_API_VERSION >= 38
/**
C++ Interface for standard deviation of all elements

\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias.
\return standard deviation of the entire input array

\ingroup stat_func_stdev
*/
template <typename T> AFAPI T stdev(const array &in, const af_var_bias bias);
#endif

/**
C++ Interface for median of all elements
Expand Down Expand Up @@ -231,7 +326,6 @@ AFAPI T corrcoef(const array& X, const array& Y);
AFAPI void topk(array &values, array &indices, const array& in, const int k,
const int dim = -1, const topkFunction order = AF_TOPK_MAX);
#endif

}
#endif

Expand Down Expand Up @@ -278,9 +372,31 @@ AFAPI af_err af_mean_weighted(af_array *out, const af_array in, const af_array w

\ingroup stat_func_var

\deprecated Use \ref af_var_v2 instead
*/
AF_DEPRECATED("Use af_var_v2")
AFAPI af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim);

#if AF_API_VERSION >= 38
/**
C Interface for variance

\param[out] out will contain the variance of the input array along dimension
\p dim
\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias
\param[in] dim the dimension along which the variance is extracted
\return \ref AF_SUCCESS if the operation is successful, otherwise an
appropriate error code is returned.

\ingroup stat_func_var

*/
AFAPI af_err af_var_v2(af_array *out, const af_array in, const af_var_bias bias,
const dim_t dim);
#endif

/**
C Interface for variance of weighted input array

Expand Down Expand Up @@ -324,9 +440,31 @@ AFAPI af_err af_meanvar(af_array *mean, af_array *var, const af_array in,

\ingroup stat_func_stdev

\deprecated Use \ref af_stdev_v2 instead
*/
AF_DEPRECATED("Use af_stdev_v2")
AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim);

#if AF_API_VERSION >= 38
/**
C Interface for standard deviation

\param[out] out will contain the standard deviation of the input array along
dimension \p dim
\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias
\param[in] dim the dimension along which the standard deviation is extracted
\return \ref AF_SUCCESS if the operation is successful, otherwise an
appropriate error code is returned.

\ingroup stat_func_stdev

*/
AFAPI af_err af_stdev_v2(af_array *out, const af_array in,
const af_var_bias bias, const dim_t dim);
#endif

/**
C Interface for covariance

Expand All @@ -338,9 +476,30 @@ AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim);
otherwise an appropriate error code is returned.

\ingroup stat_func_cov

\deprecated Use \ref af_cov_v2 instead
*/
AF_DEPRECATED("Use af_cov_v2")
AFAPI af_err af_cov(af_array* out, const af_array X, const af_array Y, const bool isbiased);

#if AF_API_VERSION >= 38
/**
C Interface for covariance

\param[out] out will the covariance of the input arrays
\param[in] X is the first input array
\param[in] Y is the second input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias
\return \ref AF_SUCCESS if the operation is successful, otherwise an
appropriate error code is returned.

\ingroup stat_func_cov
*/
AFAPI af_err af_cov_v2(af_array *out, const af_array X, const af_array Y,
const af_var_bias bias);
#endif

/**
C Interface for median

Expand Down Expand Up @@ -393,9 +552,32 @@ AFAPI af_err af_mean_all_weighted(double *real, double *imag, const af_array in,
otherwise an appropriate error code is returned.

\ingroup stat_func_var

\deprecated Use \ref af_var_all_v2 instead
*/
AF_DEPRECATED("Use af_var_all_v2")
AFAPI af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased);

#if AF_API_VERSION >= 38
/**
C Interface for variance of all elements

\param[out] realVal will contain the real part of variance of the entire
input array
\param[out] imagVal will contain the imaginary part of variance
of the entire input array
\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias
\return \ref AF_SUCCESS if the operation is successful, otherwise an
appropriate error code is returned.

\ingroup stat_func_var
*/
AFAPI af_err af_var_all_v2(double *realVal, double *imagVal, const af_array in,
const af_var_bias bias);
#endif

/**
C Interface for variance of all elements in weighted input

Expand All @@ -420,9 +602,32 @@ AFAPI af_err af_var_all_weighted(double *realVal, double *imagVal, const af_arra
otherwise an appropriate error code is returned.

\ingroup stat_func_stdev

\deprecated Use \ref af_stdev_all_v2 instead
*/
AF_DEPRECATED("Use af_stdev_all_v2")
AFAPI af_err af_stdev_all(double *real, double *imag, const af_array in);

#if AF_API_VERSION >= 38
/**
C Interface for standard deviation of all elements

\param[out] real will contain the real part of standard deviation of the
entire input array
\param[out] imag will contain the imaginary part of standard deviation
of the entire input array
\param[in] in is the input array
\param[in] bias The type of bias used for variance calculation. Takes of
value of type \ref af_var_bias
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.

\ingroup stat_func_stdev
*/
AFAPI af_err af_stdev_all_v2(double *real, double *imag, const af_array in,
const af_var_bias bias);
#endif

/**
C Interface for median

Expand Down
Loading