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 
57 AFAPI array var(const array& in, const bool isbiased=false, const dim_t dim=-1);
58 
71 AFAPI array var(const array& in, const array &weights, const dim_t dim=-1);
72 
73 #if AF_API_VERSION >= 37
74 
86 AFAPI void meanvar(array& mean, array& var, const array& in, const array& weights,
87  const af_var_bias bias = AF_VARIANCE_POPULATION, const dim_t dim=-1);
88 #endif
89 
101 AFAPI array stdev(const array& in, const dim_t dim=-1);
102 
103 
114 AFAPI array cov(const array& X, const array& Y, const bool isbiased=false);
115 
127 AFAPI array median(const array& in, const dim_t dim=-1);
128 
137 template<typename T>
138 AFAPI T mean(const array& in);
139 
149 template<typename T>
150 AFAPI T mean(const array& in, const array& weights);
151 
161 template<typename T>
162 AFAPI T var(const array& in, const bool isbiased=false);
163 
173 template<typename T>
174 AFAPI T var(const array& in, const array& weights);
175 
184 template<typename T>
185 AFAPI T stdev(const array& in);
186 
195 template<typename T>
196 AFAPI T median(const array& in);
197 
209 template<typename T>
210 AFAPI T corrcoef(const array& X, const array& Y);
211 
212 #if AF_API_VERSION >= 36
213 
231 AFAPI void topk(array &values, array &indices, const array& in, const int k,
232  const int dim = -1, const topkFunction order = AF_TOPK_MAX);
233 #endif
234 
235 }
236 #endif
237 
238 #ifdef __cplusplus
239 extern "C" {
240 #endif
241 
253 AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim);
254 
267 AFAPI af_err af_mean_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
268 
282 AFAPI af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim);
283 
297 AFAPI af_err af_var_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
298 
299 #if AF_API_VERSION >= 37
300 
313  const af_array weights, const af_var_bias bias, const dim_t dim);
314 #endif
315 
328 AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim);
329 
342 AFAPI af_err af_cov(af_array* out, const af_array X, const af_array Y, const bool isbiased);
343 
355 AFAPI af_err af_median(af_array* out, const af_array in, const dim_t dim);
356 
368 AFAPI af_err af_mean_all(double *real, double *imag, const af_array in);
369 
382 AFAPI af_err af_mean_all_weighted(double *real, double *imag, const af_array in, const af_array weights);
383 
384 
397 AFAPI af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased);
398 
411 AFAPI af_err af_var_all_weighted(double *realVal, double *imagVal, const af_array in, const af_array weights);
412 
424 AFAPI af_err af_stdev_all(double *real, double *imag, const af_array in);
425 
437 AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in);
438 
453 AFAPI af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y);
454 
455 #if AF_API_VERSION >= 36
456 
474 AFAPI af_err af_topk(af_array *values, af_array *indices, const af_array in,
475  const int k, const int dim, const af_topk_function order);
476 #endif
477 
478 #ifdef __cplusplus
479 }
480 #endif
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::median
AFAPI array median(const array &in, const dim_t dim=-1)
C++ Interface for median.
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_topk_function
af_topk_function
Definition: defines.h:510
af::corrcoef
AFAPI T corrcoef(const array &X, const array &Y)
C++ Interface for correlation coefficient.
af_median
AFAPI af_err af_median(af_array *out, const af_array in, const dim_t dim)
C Interface for median.
dim_t
long long dim_t
Definition: defines.h:56
af_var_bias
af_var_bias
Definition: defines.h:518
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::mean
AFAPI array mean(const array &in, const dim_t dim=-1)
C++ Interface for mean.
AFAPI
#define AFAPI
Definition: defines.h:38
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::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::cov
AFAPI array cov(const array &X, const array &Y, const bool isbiased=false)
C++ Interface for covariance.
af
Definition: algorithm.h:14
af::var
AFAPI array var(const array &in, const bool isbiased=false, const dim_t dim=-1)
C++ Interface for variance.
AF_TOPK_MAX
@ AF_TOPK_MAX
Top k max values.
Definition: defines.h:512
af_array
void * af_array
Definition: defines.h:240
af::stdev
AFAPI array stdev(const array &in, const dim_t dim=-1)
C++ Interface for standard deviation.
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_mean
AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim)
C Interface for mean.
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_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_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.
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_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::real
AFAPI array real(const array &in)
C++ Interface for getting real part from complex array.
afcl::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
af_stdev
AFAPI af_err af_stdev(af_array *out, const af_array in, const dim_t dim)
C Interface for standard deviation.
af::mean
AFAPI T mean(const array &in, const array &weights)
C++ Interface for mean of all elements in weighted input.
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_all
AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in)
C Interface for median.
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::imag
AFAPI array imag(const array &in)
C++ Interface for getting imaginary part from complex array.
AF_VARIANCE_POPULATION
@ AF_VARIANCE_POPULATION
Population variance.
Definition: defines.h:521
af::var
AFAPI T var(const array &in, const array &weights)
C++ Interface for variance of all elements in weighted input.
af_err
af_err
Definition: defines.h:71
defines.h
af::topkFunction
af_topk_function topkFunction
Definition: defines.h:593