Zephyr Scientific Library (zscilib)
|
Go to the documentation of this file.
16 #if CONFIG_ZSL_BOUNDS_CHECKS
23 if (*x >= *a && *x <= *b) {
24 return 1. / (*b - *a);
32 #if CONFIG_ZSL_BOUNDS_CHECKS
46 #if CONFIG_ZSL_BOUNDS_CHECKS
53 *v = (*b - *a) * (*b - *a) / 12.0;
60 #if CONFIG_ZSL_BOUNDS_CHECKS
67 if (*x >= *a && *x <= *b) {
68 return (*x - *a) / (*b - *a);
81 ZSL_POW(
ZSL_E, -0.5 * ((*x - *m) / *s) * ((*x - *m) / *s));
99 #if CONFIG_ZSL_BOUNDS_CHECKS
101 if (*x <= -1.0 || *x >= 1.0) {
106 t =
ZSL_FMA(*x, 0.0 - *x, 1.0);
110 p =
ZSL_FMA(p, t, 2.93243101e-8);
111 p =
ZSL_FMA(p, t, 1.22150334e-6);
112 p =
ZSL_FMA(p, t, 2.84108955e-5);
113 p =
ZSL_FMA(p, t, 3.93552968e-4);
114 p =
ZSL_FMA(p, t, 3.02698812e-3);
115 p =
ZSL_FMA(p, t, 4.83185798e-3);
116 p =
ZSL_FMA(p, t, -2.64646143e-1);
117 p =
ZSL_FMA(p, t, 8.40016484e-1);
120 p =
ZSL_FMA(p, t, 1.43285448e-7);
121 p =
ZSL_FMA(p, t, 1.22774793e-6);
122 p =
ZSL_FMA(p, t, 1.12963626e-7);
123 p =
ZSL_FMA(p, t, -5.61530760e-5);
124 p =
ZSL_FMA(p, t, -1.47697632e-4);
125 p =
ZSL_FMA(p, t, 2.31468678e-3);
126 p =
ZSL_FMA(p, t, 1.15392581e-2);
127 p =
ZSL_FMA(p, t, -2.32015476e-1);
128 p =
ZSL_FMA(p, t, 8.86226892e-1);
138 #if CONFIG_ZSL_BOUNDS_CHECKS
140 if (*p <= 0.0 || *p >= 1.0) {
153 if (*n == 0 || *n == 1) {
161 for (
int i = 1; i < *n; i++) {
170 #if CONFIG_ZSL_BOUNDS_CHECKS
177 if (*k > *n || *k < 0) {
191 #if CONFIG_ZSL_BOUNDS_CHECKS
193 if (*p > 1.0 || *p < 0.0) {
210 #if CONFIG_ZSL_BOUNDS_CHECKS
212 if (*p > 1.0 || *p < 0.0) {
228 #if CONFIG_ZSL_BOUNDS_CHECKS
230 if (*p > 1.0 || *p < 0.0) {
239 *v = *n * *p * (1. - *p);
246 #if CONFIG_ZSL_BOUNDS_CHECKS
248 if (*p > 1.0 || *p < 0.0) {
263 for (
int i = 0; i <= *x; i++) {
276 #if CONFIG_ZSL_BOUNDS_CHECKS
280 for (
size_t i = 0; i < v->
sz; i++) {
281 if (v->
data[i] < 0.0) {
292 for (
size_t i = 0; i < v->
sz; i++) {
305 #if CONFIG_ZSL_BOUNDS_CHECKS
307 if (*pa < 0.0 || *pa > 1.0) {
310 if (*pb <= 0.0 || *pb > 1.0 || *pb < *pa * *pba) {
313 if (*pba < 0.0 || *pba > 1.0) {
318 *pab = (*pba * *pa) / *pb;
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,...
API header file for probability in zscilib.
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 (...
int zsl_prob_binomial_mean(int *n, zsl_real_t *p, zsl_real_t *m)
Computes the mean of a binomial probability distribution function.
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).
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 ...
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,...
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).
int zsl_prob_binomial_coef(int *n, int *k, int *c)
Computes binomial coefficient of n and k (commonly writen as 'n over k').
zsl_real_t zsl_prob_normal_cdf_inv(zsl_real_t *m, zsl_real_t *s, zsl_real_t *p)
Computes the inverse of the normal cumulative distribution function of a value x.
API header file for zscilib.
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...
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)...
int zsl_prob_entropy(struct zsl_vec *v, zsl_real_t *h)
Computes the Shannon entropy of a set of events with given probabilities.
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),...
int zsl_prob_binomial_var(int *n, zsl_real_t *p, zsl_real_t *v)
Computes the variance of a binomial probability distribution function.
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...
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).