Zephyr Scientific Library (zscilib)
probability.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020 Kevin Townsend (KTOWN)
3  * Copyright (c) 2021 Marti Riba Pons
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
23 #ifndef ZEPHYR_INCLUDE_ZSL_PROBABILITY_H_
24 #define ZEPHYR_INCLUDE_ZSL_PROBABILITY_H_
25 
26 #include <zsl/zsl.h>
27 #include <zsl/vectors.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
48 
62 
76 
91 
104 
117 
128 
141 
142 
152 int zsl_prob_factorial(int *n);
153 
165 int zsl_prob_binomial_coef(int *n, int *k, int *c);
166 
182 zsl_real_t zsl_prob_binomial_pdf(int *n, zsl_real_t *p, int *x);
183 
194 int zsl_prob_binomial_mean(int *n, zsl_real_t *p, zsl_real_t *m);
195 
206 int zsl_prob_binomial_var(int *n, zsl_real_t *p, zsl_real_t *v);
207 
219 zsl_real_t zsl_prob_binomial_cdf(int *n, zsl_real_t *p, int *x);
220 
230 int zsl_prob_factorial(int *n);
231 
243 int zsl_prob_binomial_coef(int *n, int *k, int *c);
244 
260 zsl_real_t zsl_prob_binomial_pdf(int *n, zsl_real_t *p, int *x);
261 
272 int zsl_prob_binomial_mean(int *n, zsl_real_t *p, zsl_real_t *m);
273 
284 int zsl_prob_binomial_var(int *n, zsl_real_t *p, zsl_real_t *v);
285 
297 zsl_real_t zsl_prob_binomial_cdf(int *n, zsl_real_t *p, int *x);
298 
309 int zsl_prob_entropy(struct zsl_vec *v, zsl_real_t *h);
310 
325  zsl_real_t *pab);
326 
327 #ifdef __cplusplus
328 }
329 #endif
330 
331 #endif /* ZEPHYR_INCLUDE_ZSL_PROBABILITY_H_ */
332  /* End of probability group */
zsl_prob_uni_var
int zsl_prob_uni_var(zsl_real_t *a, zsl_real_t *b, zsl_real_t *v)
Computes the variance of a uniform probability distribution function of interval (a,...
Definition: probability.c:44
zsl_prob_uni_cdf
zsl_real_t zsl_prob_uni_cdf(zsl_real_t *a, zsl_real_t *b, zsl_real_t *x)
Computes the image of a value x of the uniform cumulative distribution function (CDF) with interval (...
Definition: probability.c:58
zsl_prob_binomial_mean
int zsl_prob_binomial_mean(int *n, zsl_real_t *p, zsl_real_t *m)
Computes the mean of a binomial probability distribution function.
Definition: probability.c:208
zsl_prob_binomial_pdf
zsl_real_t zsl_prob_binomial_pdf(int *n, zsl_real_t *p, int *x)
Computes the image of a value x of the binomial probability distribution function (PDF).
Definition: probability.c:189
zsl_prob_normal_cdf
zsl_real_t zsl_prob_normal_cdf(zsl_real_t *m, zsl_real_t *s, zsl_real_t *x)
Computes the image of a value x of the normal cumulative distribution function (CDF) of mean 'm' and ...
Definition: probability.c:86
zsl_prob_bayes
int zsl_prob_bayes(zsl_real_t *pa, zsl_real_t *pb, zsl_real_t *pba, zsl_real_t *pab)
Computes the probability of an event A to occur given the event B, based on the probability of A,...
Definition: probability.c:301
vectors.h
API header file for vectors in zscilib.
zsl_prob_uni_mean
int zsl_prob_uni_mean(zsl_real_t *a, zsl_real_t *b, zsl_real_t *m)
Computes the mean of a uniform probability distribution function of interval (a, b).
Definition: probability.c:30
zsl_prob_binomial_coef
int zsl_prob_binomial_coef(int *n, int *k, int *c)
Computes binomial coefficient of n and k (commonly writen as 'n over k').
Definition: probability.c:168
zsl_prob_normal_cdf_inv
zsl_real_t zsl_prob_normal_cdf_inv(zsl_real_t *m, zsl_real_t *s, zsl_real_t *x)
Computes the inverse of the normal cumulative distribution function of a value x.
Definition: probability.c:134
zsl.h
API header file for zscilib.
zsl_vec
Represents a vector.
Definition: vectors.h:40
zsl_prob_normal_pdf
zsl_real_t zsl_prob_normal_pdf(zsl_real_t *m, zsl_real_t *s, zsl_real_t *x)
Computes the image of a value x of the normal probability distribution function (PDF) of mean 'm' and...
Definition: probability.c:76
zsl_prob_factorial
int zsl_prob_factorial(int *n)
Computes the factorial of a natural number, i. e., the finite product n * (n - 1) * (n - 2) * (n - 3)...
Definition: probability.c:151
zsl_prob_entropy
int zsl_prob_entropy(struct zsl_vec *v, zsl_real_t *h)
Computes the Shannon entropy of a set of events with given probabilities.
Definition: probability.c:274
zsl_real_t
double zsl_real_t
Definition: zsl.h:51
zsl_prob_uni_pdf
zsl_real_t zsl_prob_uni_pdf(zsl_real_t *a, zsl_real_t *b, zsl_real_t *x)
Computes the image of a value x of the uniform probability distribution function (PDF),...
Definition: probability.c:14
zsl_prob_binomial_var
int zsl_prob_binomial_var(int *n, zsl_real_t *p, zsl_real_t *v)
Computes the variance of a binomial probability distribution function.
Definition: probability.c:226
zsl_prob_erf_inv
zsl_real_t zsl_prob_erf_inv(zsl_real_t *x)
Computes the value of the inverse error fuction of a value 'x' using the Chebyshev interpolation to e...
Definition: probability.c:95
zsl_prob_binomial_cdf
zsl_real_t zsl_prob_binomial_cdf(int *n, zsl_real_t *p, int *x)
Computes the image of a value x of the ubinomial cumulative distribution function (CDF).
Definition: probability.c:244