statistics.h (2022-02-24 14:07:56 -0500, (build 8c2561559))
Go to the documentation of this file.
1/*******************************************************
2 * Copyright (c) 2014, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10#pragma once
11#include <af/defines.h>
12
13#ifdef __cplusplus
14namespace af
15{
16class array;
17
29AFAPI array mean(const array& in, const dim_t dim=-1);
30
43AFAPI array mean(const array& in, const array& weights, const dim_t dim=-1);
44
60AF_DEPRECATED("Use \ref af::var(const array&, const af_var_bias, const dim_t)")
61AFAPI array var(const array& in, const bool isbiased=false, const dim_t dim=-1);
62
63#if AF_API_VERSION >= 38
77AFAPI array var(const array &in, const af_var_bias bias, const dim_t dim = -1);
78#endif
79
92AFAPI array var(const array& in, const array &weights, const dim_t dim=-1);
93
94#if AF_API_VERSION >= 37
107AFAPI void meanvar(array& mean, array& var, const array& in, const array& weights,
108 const af_var_bias bias = AF_VARIANCE_POPULATION, const dim_t dim=-1);
109#endif
110
124AF_DEPRECATED("Use af::stdev(const array&, const af_var_bias, const dim_t)")
125AFAPI array stdev(const array& in, const dim_t dim=-1);
126
127#if AF_API_VERSION >= 38
141AFAPI array stdev(const array &in, const af_var_bias bias,
142 const dim_t dim = -1);
143#endif
144
158AF_DEPRECATED("Use af::cov(const af::array&, const array&, conv af_var_bias)")
159AFAPI array cov(const array& X, const array& Y, const bool isbiased=false);
160
161#if AF_API_VERSION >= 38
173AFAPI array cov(const array &X, const array &Y, const af_var_bias bias);
174#endif
175
187AFAPI array median(const array& in, const dim_t dim=-1);
188
197template<typename T>
198AFAPI T mean(const array& in);
199
209template<typename T>
210AFAPI T mean(const array& in, const array& weights);
211
224template <typename T>
225AF_DEPRECATED("Use af::var(const af::array&, const af_var_bias)")
226AFAPI T var(const array &in, const bool isbiased = false);
227
228#if AF_API_VERSION >= 38
239template <typename T> AFAPI T var(const array &in, const af_var_bias bias);
240#endif
241
251template<typename T>
252AFAPI T var(const array& in, const array& weights);
253
264template <typename T>
265AF_DEPRECATED("Use af::stdev(const array&, const af_var_bias)")
266AFAPI T stdev(const array &in);
267
268#if AF_API_VERSION >= 38
279template <typename T> AFAPI T stdev(const array &in, const af_var_bias bias);
280#endif
281
290template<typename T>
291AFAPI T median(const array& in);
292
304template<typename T>
305AFAPI T corrcoef(const array& X, const array& Y);
306
307#if AF_API_VERSION >= 36
326AFAPI void topk(array &values, array &indices, const array& in, const int k,
327 const int dim = -1, const topkFunction order = AF_TOPK_MAX);
328#endif
329}
330#endif
331
332#ifdef __cplusplus
333extern "C" {
334#endif
335
347AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim);
348
361AFAPI af_err af_mean_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
362
377AF_DEPRECATED("Use af_var_v2")
378AFAPI af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim);
379
380#if AF_API_VERSION >= 38
397 const dim_t dim);
398#endif
399
413AFAPI af_err af_var_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
414
415#if AF_API_VERSION >= 37
429 const af_array weights, const af_var_bias bias, const dim_t dim);
430#endif
431
445AF_DEPRECATED("Use af_stdev_v2")
446AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim);
447
448#if AF_API_VERSION >= 38
465 const af_var_bias bias, const dim_t dim);
466#endif
467
482AF_DEPRECATED("Use af_cov_v2")
483AFAPI af_err af_cov(af_array* out, const af_array X, const af_array Y, const bool isbiased);
484
485#if AF_API_VERSION >= 38
500 const af_var_bias bias);
501#endif
502
514AFAPI af_err af_median(af_array* out, const af_array in, const dim_t dim);
515
527AFAPI af_err af_mean_all(double *real, double *imag, const af_array in);
528
541AFAPI af_err af_mean_all_weighted(double *real, double *imag, const af_array in, const af_array weights);
542
543
558AF_DEPRECATED("Use af_var_all_v2")
559AFAPI af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased);
560
561#if AF_API_VERSION >= 38
577AFAPI af_err af_var_all_v2(double *realVal, double *imagVal, const af_array in,
578 const af_var_bias bias);
579#endif
580
593AFAPI af_err af_var_all_weighted(double *realVal, double *imagVal, const af_array in, const af_array weights);
594
608AF_DEPRECATED("Use af_stdev_all_v2")
609AFAPI af_err af_stdev_all(double *real, double *imag, const af_array in);
610
611#if AF_API_VERSION >= 38
627AFAPI af_err af_stdev_all_v2(double *real, double *imag, const af_array in,
628 const af_var_bias bias);
629#endif
630
642AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in);
643
658AFAPI af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y);
659
660#if AF_API_VERSION >= 36
679AFAPI af_err af_topk(af_array *values, af_array *indices, const af_array in,
680 const int k, const int dim, const af_topk_function order);
681#endif
682
683#ifdef __cplusplus
684}
685#endif
A multi dimensional data container.
Definition: array.h:37
long long dim_t
Definition: defines.h:56
af_err
Definition: defines.h:71
void * af_array
Definition: defines.h:240
#define AF_DEPRECATED(msg)
Definition: defines.h:44
af_topk_function
Definition: defines.h:510
@ AF_TOPK_MAX
Top k max values.
Definition: defines.h:512
af_var_bias
Definition: defines.h:518
@ AF_VARIANCE_POPULATION
Population variance.
Definition: defines.h:521
#define AFAPI
Definition: defines.h:38
AFAPI array imag(const array &in)
C++ Interface for getting imaginary part from complex array.
AFAPI array real(const array &in)
C++ Interface for getting real part from complex array.
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
AFAPI af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y)
C Interface for correlation coefficient.
AFAPI T corrcoef(const array &X, const array &Y)
C++ Interface for correlation coefficient.
AFAPI af_err af_cov(af_array *out, const af_array X, const af_array Y, const bool isbiased)
C Interface for covariance.
AFAPI af_err af_cov_v2(af_array *out, const af_array X, const af_array Y, const af_var_bias bias)
C Interface for covariance.
AFAPI array cov(const array &X, const array &Y, const bool isbiased=false)
C++ Interface for covariance.
AFAPI af_err af_mean_all_weighted(double *real, double *imag, const af_array in, const af_array weights)
C Interface for mean of all elements in weighted input.
AFAPI af_err af_mean_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim)
C Interface for mean of weighted input array.
AFAPI array mean(const array &in, const dim_t dim=-1)
C++ Interface for mean.
AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim)
C Interface for mean.
AFAPI af_err af_mean_all(double *real, double *imag, const af_array in)
C Interface for mean of all elements.
AFAPI T mean(const array &in, const array &weights)
C++ Interface for mean of all elements in weighted input.
AFAPI array median(const array &in, const dim_t dim=-1)
C++ Interface for median.
AFAPI af_err af_median(af_array *out, const af_array in, const dim_t dim)
C Interface for median.
AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in)
C Interface for median.
AFAPI af_err af_stdev_all(double *real, double *imag, const af_array in)
C Interface for standard deviation of all elements.
AFAPI af_err af_stdev_all_v2(double *real, double *imag, const af_array in, const af_var_bias bias)
C Interface for standard deviation of all elements.
AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim)
C Interface for standard deviation.
AFAPI array stdev(const array &in, const dim_t dim=-1)
C++ Interface for standard deviation.
AFAPI af_err af_stdev_v2(af_array *out, const af_array in, const af_var_bias bias, const dim_t dim)
C Interface for standard deviation.
AFAPI void topk(array &values, array &indices, const array &in, const int k, const int dim=-1, const topkFunction order=AF_TOPK_MAX)
C++ Interface for finding top k elements along a given dimension.
AFAPI af_err af_topk(af_array *values, af_array *indices, const af_array in, const int k, const int dim, const af_topk_function order)
C Interface for finding top k elements along a given dimension.
AFAPI af_err af_var_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim)
C Interface for variance of weighted input array.
AFAPI af_err af_var_all_weighted(double *realVal, double *imagVal, const af_array in, const af_array weights)
C Interface for variance of all elements in weighted input.
AFAPI array var(const array &in, const bool isbiased=false, const dim_t dim=-1)
C++ Interface for variance.
AFAPI af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased)
C Interface for variance of all elements.
AFAPI af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim)
C Interface for variance.
AFAPI T var(const array &in, const array &weights)
C++ Interface for variance of all elements in weighted input.
AFAPI af_err af_var_all_v2(double *realVal, double *imagVal, const af_array in, const af_var_bias bias)
C Interface for variance of all elements.
AFAPI af_err af_var_v2(af_array *out, const af_array in, const af_var_bias bias, const dim_t dim)
C Interface for variance.
Definition: algorithm.h:15
AFAPI void meanvar(array &mean, array &var, const array &in, const array &weights, const af_var_bias bias=AF_VARIANCE_POPULATION, const dim_t dim=-1)
C++ Interface for mean and variance.
AFAPI af_err af_meanvar(af_array *mean, af_array *var, const af_array in, const af_array weights, const af_var_bias bias, const dim_t dim)
C Interface for mean and variance.