A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

statistics.h
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
14 namespace af
15{
16 class array;
17
29 AFAPI array mean(const array& in, const dim_t dim=-1);
30
43 AFAPI array mean(const array& in, const array& weights, const dim_t dim=-1);
44
60 AF_DEPRECATED("Use \ref af::var(const array&, const af_var_bias, const dim_t)")
61 AFAPI array var(const array& in, const bool isbiased=false, const dim_t dim=-1);
62
63#if AF_API_VERSION >= 38
77 AFAPI array var(const array &in, const af_var_bias bias, const dim_t dim = -1);
78#endif
79
92 AFAPI array var(const array& in, const array &weights, const dim_t dim=-1);
93
94#if AF_API_VERSION >= 37
107 AFAPI 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
124 AF_DEPRECATED("Use af::stdev(const array&, const af_var_bias, const dim_t)")
125 AFAPI array stdev(const array& in, const dim_t dim=-1);
126
127#if AF_API_VERSION >= 38
141 AFAPI array stdev(const array &in, const af_var_bias bias,
142 const dim_t dim = -1);
143#endif
144
158 AF_DEPRECATED("Use af::cov(const af::array&, const array&, conv af_var_bias)")
159 AFAPI array cov(const array& X, const array& Y, const bool isbiased=false);
160
161#if AF_API_VERSION >= 38
173 AFAPI array cov(const array &X, const array &Y, const af_var_bias bias);
174#endif
175
187 AFAPI array median(const array& in, const dim_t dim=-1);
188
197 template<typename T>
198 AFAPI T mean(const array& in);
199
209 template<typename T>
210 AFAPI T mean(const array& in, const array& weights);
211
224 template <typename T>
225 AF_DEPRECATED("Use af::var(const af::array&, const af_var_bias)")
226 AFAPI T var(const array &in, const bool isbiased = false);
227
228#if AF_API_VERSION >= 38
239 template <typename T> AFAPI T var(const array &in, const af_var_bias bias);
240#endif
241
251 template<typename T>
252 AFAPI T var(const array& in, const array& weights);
253
264 template <typename T>
265 AF_DEPRECATED("Use af::stdev(const array&, const af_var_bias)")
266 AFAPI T stdev(const array &in);
267
268#if AF_API_VERSION >= 38
279 template <typename T> AFAPI T stdev(const array &in, const af_var_bias bias);
280#endif
281
290 template<typename T>
291 AFAPI T median(const array& in);
292
304 template<typename T>
305 AFAPI T corrcoef(const array& X, const array& Y);
306
307#if AF_API_VERSION >= 36
327 AFAPI void topk(array &values, array &indices, const array& in, const int k,
328 const int dim = -1, const topkFunction order = AF_TOPK_MAX);
329#endif
330}
331#endif
332
333#ifdef __cplusplus
334 extern "C" {
335#endif
336
348 AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim);
349
362 AFAPI af_err af_mean_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
363
378 AF_DEPRECATED("Use af_var_v2")
379 AFAPI af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim);
380
381#if AF_API_VERSION >= 38
397 AFAPI af_err af_var_v2(af_array *out, const af_array in, const af_var_bias bias,
398 const dim_t dim);
399#endif
400
414 AFAPI af_err af_var_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
415
416#if AF_API_VERSION >= 37
429 AFAPI af_err af_meanvar(af_array *mean, af_array *var, const af_array in,
430 const af_array weights, const af_var_bias bias, const dim_t dim);
431#endif
432
446 AF_DEPRECATED("Use af_stdev_v2")
447 AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim);
448
449#if AF_API_VERSION >= 38
465 AFAPI af_err af_stdev_v2(af_array *out, const af_array in,
466 const af_var_bias bias, const dim_t dim);
467#endif
468
483 AF_DEPRECATED("Use af_cov_v2")
484 AFAPI af_err af_cov(af_array* out, const af_array X, const af_array Y, const bool isbiased);
485
486#if AF_API_VERSION >= 38
500 AFAPI af_err af_cov_v2(af_array *out, const af_array X, const af_array Y,
501 const af_var_bias bias);
502#endif
503
515 AFAPI af_err af_median(af_array* out, const af_array in, const dim_t dim);
516
528 AFAPI af_err af_mean_all(double *real, double *imag, const af_array in);
529
542 AFAPI af_err af_mean_all_weighted(double *real, double *imag, const af_array in, const af_array weights);
543
544
559 AF_DEPRECATED("Use af_var_all_v2")
560 AFAPI af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased);
561
562#if AF_API_VERSION >= 38
578 AFAPI af_err af_var_all_v2(double *realVal, double *imagVal, const af_array in,
579 const af_var_bias bias);
580#endif
581
594 AFAPI af_err af_var_all_weighted(double *realVal, double *imagVal, const af_array in, const af_array weights);
595
609 AF_DEPRECATED("Use af_stdev_all_v2")
610 AFAPI af_err af_stdev_all(double *real, double *imag, const af_array in);
611
612#if AF_API_VERSION >= 38
628 AFAPI af_err af_stdev_all_v2(double *real, double *imag, const af_array in,
629 const af_var_bias bias);
630#endif
631
643 AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in);
644
659 AFAPI af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y);
660
661#if AF_API_VERSION >= 36
681 AFAPI af_err af_topk(af_array *values, af_array *indices, const af_array in,
682 const int k, const int dim, const af_topk_function order);
683#endif
684
685#ifdef __cplusplus
686}
687#endif
af::array
A multi dimensional data container.
Definition array.h:37
defines.h
dim_t
long long dim_t
Definition defines.h:56
af_err
af_err
Definition defines.h:71
af_array
void * af_array
Definition defines.h:240
AF_DEPRECATED
#define AF_DEPRECATED(msg)
Definition defines.h:44
af_topk_function
af_topk_function
Definition defines.h:511
AF_TOPK_MAX
@ AF_TOPK_MAX
Top k max values.
Definition defines.h:513
af_var_bias
af_var_bias
Definition defines.h:522
AF_VARIANCE_POPULATION
@ AF_VARIANCE_POPULATION
Population variance.
Definition defines.h:525
AFAPI
#define AFAPI
Definition defines.h:38
af_corrcoef
AFAPI af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y)
C Interface for correlation coefficient.
af::corrcoef
AFAPI T corrcoef(const array &X, const array &Y)
C++ Interface for correlation coefficient.
af_cov
AFAPI af_err af_cov(af_array *out, const af_array X, const af_array Y, const bool isbiased)
C Interface for covariance.
af_cov_v2
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.
af::cov
AFAPI array cov(const array &X, const array &Y, const bool isbiased=false)
C++ Interface for covariance.
af_mean_all_weighted
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.
af_mean_weighted
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.
af::mean
AFAPI array mean(const array &in, const dim_t dim=-1)
C++ Interface for mean.
af_mean
AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim)
C Interface for mean.
af_mean_all
AFAPI af_err af_mean_all(double *real, double *imag, const af_array in)
C Interface for mean of all elements.
af::median
AFAPI array median(const array &in, const dim_t dim=-1)
C++ Interface for median.
af_median
AFAPI af_err af_median(af_array *out, const af_array in, const dim_t dim)
C Interface for median.
af_median_all
AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in)
C Interface for median.
af_stdev_all
AFAPI af_err af_stdev_all(double *real, double *imag, const af_array in)
C Interface for standard deviation of all elements.
af::stdev
AFAPI array stdev(const array &in, const dim_t dim=-1)
C++ Interface for standard deviation.
af_stdev_all_v2
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.
af_stdev
AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim)
C Interface for standard deviation.
af_stdev_v2
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.
af::topk
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.
af_topk
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.
af_var_weighted
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.
af::var
AFAPI array var(const array &in, const bool isbiased=false, const dim_t dim=-1)
C++ Interface for variance.
af_var_all_weighted
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.
af_var_all
AFAPI af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased)
C Interface for variance of all elements.
af_var
AFAPI af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim)
C Interface for variance.
af_var_all_v2
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.
af_var_v2
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.
af
Definition algorithm.h:15
af::meanvar
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.
af_meanvar
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.