/usr/include/af/statistics.h is in libarrayfire-dev 3.2.2+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | /*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#pragma once
#include <af/defines.h>
#ifdef __cplusplus
namespace af
{
class array;
/**
C++ Interface for mean
\param[in] in is the input array
\param[in] dim the dimension along which the mean is extracted
\return the mean of the input array along dimension \p dim
\ingroup stat_func_mean
\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
*/
AFAPI array mean(const array& in, const dim_t dim=-1);
/**
C++ Interface for mean of weighted inputs
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting mean
\param[in] dim the dimension along which the mean is extracted
\return the mean of the weighted input array along dimension \p dim
\ingroup stat_func_mean
\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
*/
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] 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 bool isbiased=false, const dim_t dim=-1);
/**
C++ Interface for variance of weighted inputs
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting variance
\param[in] dim the dimension along which the variance is extracted
\return the variance of the weighted 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 array &weights, const dim_t dim=-1);
/**
C++ Interface for standard deviation
\param[in] in is the input array
\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 dim_t dim=-1);
/**
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)
\return the covariance of the input arrays
\ingroup stat_func_cov
*/
AFAPI array cov(const array& X, const array& Y, const bool isbiased=false);
/**
C++ Interface for median
\param[in] in is the input array
\param[in] dim the dimension along which the median is extracted
\return the median of the input array along dimension \p dim
\ingroup stat_func_median
\note \p dim is -1 by default. -1 denotes the first non-singleton dimension.
*/
AFAPI array median(const array& in, const dim_t dim=-1);
/**
C++ Interface for mean of all elements
\param[in] in is the input array
\return mean of the entire input array
\ingroup stat_func_mean
*/
template<typename T>
AFAPI T mean(const array& in);
/**
C++ Interface for mean of all elements in weighted input
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting mean
\return mean of the entire weighted input array
\ingroup stat_func_mean
*/
template<typename T>
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
\ingroup stat_func_var
*/
template<typename T>
AFAPI T var(const array& in, const bool isbiased=false);
/**
C++ Interface for variance of all elements in weighted input
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting variance
\return variance of the entire input array
\ingroup stat_func_var
*/
template<typename T>
AFAPI T var(const array& in, const array& weights);
/**
C++ Interface for standard deviation of all elements
\param[in] in is the input array
\return standard deviation of the entire input array
\ingroup stat_func_stdev
*/
template<typename T>
AFAPI T stdev(const array& in);
/**
C++ Interface for median of all elements
\param[in] in is the input array
\return median of the entire input array
\ingroup stat_func_median
*/
template<typename T>
AFAPI T median(const array& in);
/**
C++ Interface for correlation coefficient
\param[in] X is the first input array
\param[in] Y is the second input array
\return correlation coefficient of the input arrays
\note There are many ways correlation coefficient is calculated. This algorithm returns Pearson product-moment correlation coefficient.
\ingroup stat_func_corrcoef
*/
template<typename T>
AFAPI T corrcoef(const array& X, const array& Y);
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
C Interface for mean
\param[out] out will contain the mean of the input array along dimension \p dim
\param[in] in is the input array
\param[in] dim the dimension along which the mean is extracted
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\ingroup stat_func_mean
*/
AFAPI af_err af_mean(af_array *out, const af_array in, const dim_t dim);
/**
C Interface for mean of weighted input array
\param[out] out will contain the mean of the input array along dimension \p dim
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting mean
\param[in] dim the dimension along which the mean is extracted
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\ingroup stat_func_mean
*/
AFAPI af_err af_mean_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
/**
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] isbiased is boolean denoting Population variance (false) or Sample Variance (true)
\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(af_array *out, const af_array in, const bool isbiased, const dim_t dim);
/**
C Interface for variance of weighted input array
\param[out] out will contain the variance of the input array along dimension \p dim
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting variance
\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_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim);
/**
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] 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(af_array *out, const af_array in, const dim_t dim);
/**
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] isbiased is boolean specifying if biased estimate should be taken (default: false)
\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(af_array* out, const af_array X, const af_array Y, const bool isbiased);
/**
C Interface for median
\param[out] out will contain the median of the input array along dimension \p dim
\param[in] in is the input array
\param[in] dim the dimension along which the median is extracted
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\ingroup stat_func_median
*/
AFAPI af_err af_median(af_array* out, const af_array in, const dim_t dim);
/**
C Interface for mean of all elements
\param[out] real will contain the real part of mean of the entire input array
\param[out] imag will contain the imaginary part of mean of the entire input array
\param[in] in is the input array
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\ingroup stat_func_mean
*/
AFAPI af_err af_mean_all(double *real, double *imag, const af_array in);
/**
C Interface for mean of all elements in weighted input
\param[out] real will contain the real part of mean of the entire weighted input array
\param[out] imag will contain the imaginary part of mean of the entire weighted input array
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting mean
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\ingroup stat_func_mean
*/
AFAPI af_err af_mean_all_weighted(double *real, double *imag, const af_array in, const af_array weights);
/**
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] isbiased is boolean denoting Population variance (false) or Sample Variance (true)
\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(double *realVal, double *imagVal, const af_array in, const bool isbiased);
/**
C Interface for variance of all elements in weighted input
\param[out] realVal will contain the real part of variance of the entire weighted input array
\param[out] imagVal will contain the imaginary part of variance of the entire weighted input array
\param[in] in is the input array
\param[in] weights is used to scale input \p in before getting variance
\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_weighted(double *realVal, double *imagVal, const af_array in, const af_array weights);
/**
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
\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(double *real, double *imag, const af_array in);
/**
C Interface for median
\param[out] realVal will contain the real part of median of the entire input array
\param[out] imagVal will contain the imaginary part of median of the entire input array
\param[in] in is the input array
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\ingroup stat_func_median
*/
AFAPI af_err af_median_all(double *realVal, double *imagVal, const af_array in);
/**
C Interface for correlation coefficient
\param[out] realVal will contain the real part of correlation coefficient of the inputs
\param[out] imagVal will contain the imaginary part of correlation coefficient of the inputs
\param[in] X is the first input array
\param[in] Y is the second input array
\return \ref AF_SUCCESS if the operation is successful,
otherwise an appropriate error code is returned.
\note There are many ways correlation coefficient is calculated. This algorithm returns Pearson product-moment correlation coefficient.
\ingroup stat_func_corrcoef
*/
AFAPI af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y);
#ifdef __cplusplus
}
#endif
|