Module: Numo::GSL::Pdf
- Defined in:
- ext/numo/gsl/pdf/gsl_pdf.c
Class Method Summary collapse
-
.bernoulli(k, p) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a Bernoulli distribution with probability parameter p, using the formula given above.
-
.beta(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a beta distribution with parameters a and b, using the formula given above.
-
.binomial(k, p, n) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a binomial distribution with parameters p and n, using the formula given above.
-
.bivariate_gaussian(x, y, sigma_x, sigma_y, rho) ⇒ Numo::DFloat
This function computes the probability density p(x,y) at (x,y) for a bivariate Gaussian distribution with standard deviations sigma_x, sigma_y and correlation coefficient rho, using the formula given above.
-
.cauchy(x, a) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Cauchy distribution with scale parameter a, using the formula given above.
-
.chisq(x, nu) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a chi-squared distribution with nu degrees of freedom, using the formula given above.
-
.dirichlet(alpha[], theta[], axis: nil, keepdims: false) ⇒ Numo::DFloat
This function computes the probability density $p(\theta_1, \ldots , \theta_K)$ p(\theta_1, … , \theta_K) at theta[K] for a Dirichlet distribution with parameters alpha[K], using the formula given above.
-
.dirichlet_ln(alpha[], theta[], axis: nil, keepdims: false) ⇒ Numo::DFloat
This function computes the logarithm of the probability density $p(\theta_1, \ldots , \theta_K)$ p(\theta_1, … , \theta_K) for a Dirichlet distribution with parameters alpha[K].
-
.exponential(x, mu) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for an exponential distribution with mean mu, using the formula given above.
-
.exppow(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for an exponential power distribution with scale parameter a and exponent b, using the formula given above.
-
.fdist(x, nu1, nu2) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for an F-distribution with nu1 and nu2 degrees of freedom, using the formula given above.
-
.flat(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a uniform distribution from a to b, using the formula given above.
-
.gamma(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a gamma distribution with parameters a and b, using the formula given above.
-
.gaussian(x, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Gaussian distribution with standard deviation sigma, using the formula given above.
-
.gaussian_tail(x, a, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Gaussian tail distribution with standard deviation sigma and lower limit a, using the formula given above.
-
.geometric(k, p) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a geometric distribution with probability parameter p, using the formula given above.
-
.gumbel1(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Type-1 Gumbel distribution with parameters a and b, using the formula given above.
-
.gumbel2(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Type-2 Gumbel distribution with parameters a and b, using the formula given above.
-
.hypergeometric(k, n1, n2, t) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a hypergeometric distribution with parameters n1, n2, t, using the formula given above.
-
.landau(x) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for the Landau distribution using an approximation to the formula given above.
-
.laplace(x, a) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Laplace distribution with width a, using the formula given above.
-
.logarithmic(k, p) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a logarithmic distribution with probability parameter p, using the formula given above.
-
.logistic(x, a) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a logistic distribution with scale parameter a, using the formula given above.
-
.lognormal(x, zeta, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a lognormal distribution with parameters zeta and sigma, using the formula given above.
-
.multinomial(p[], n[], [axis0,axis1,..]) ⇒ Numo::DFloat
This function computes the probability $P(n_1, n_2, \ldots, n_K)$ P(n_1, n_2, …, n_K) of sampling n[K] from a multinomial distribution with parameters p[K], using the formula given above.
-
.multinomial_ln(p[], n[], [axis0,axis1,..]) ⇒ Numo::DFloat
This function returns the logarithm of the probability for the multinomial distribution $P(n_1, n_2, \ldots, n_K)$ P(n_1, n_2, …, n_K) with parameters p[K].
-
.negative_binomial(k, p, n) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a negative binomial distribution with parameters p and n, using the formula given above.
-
.pareto(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Pareto distribution with exponent a and scale b, using the formula given above.
-
.pascal(k, p, n) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a Pascal distribution with parameters p and n, using the formula given above.
-
.poisson(k, mu) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a Poisson distribution with mean mu, using the formula given above.
-
.rayleigh(x, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Rayleigh distribution with scale parameter sigma, using the formula given above.
-
.rayleigh_tail(x, a, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Rayleigh tail distribution with scale parameter sigma and lower limit a, using the formula given above.
-
.tdist(x, nu) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a t-distribution with nu degrees of freedom, using the formula given above.
-
.ugaussian(x) ⇒ Numo::DFloat
These functions compute results for the unit Gaussian distribution.
-
.ugaussian_tail(x, a) ⇒ Numo::DFloat
These functions compute results for the tail of a unit Gaussian distribution.
-
.weibull(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Weibull distribution with scale a and exponent b, using the formula given above.
Class Method Details
.bernoulli(k, p) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a Bernoulli distribution with probability parameter p, using the formula given above.
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1555
static VALUE
pdf_s_bernoulli(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_bernoulli,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //p
return na_ndloop3(&ndf,opt,1,v0);
}
|
.beta(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a beta distribution with parameters a and b, using the formula given above.
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1060
static VALUE
pdf_s_beta(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_beta,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.binomial(k, p, n) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a binomial distribution with parameters p and n, using the formula given above.
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1612
static VALUE
pdf_s_binomial(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
unsigned int c2;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_binomial,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //p
c2 = NUM2UINT(v2); opt[1] = &c2; //n
return na_ndloop3(&ndf,opt,1,v0);
}
|
.bivariate_gaussian(x, y, sigma_x, sigma_y, rho) ⇒ Numo::DFloat
This function computes the probability density p(x,y) at (x,y) for a bivariate Gaussian distribution with standard deviations sigma_x, sigma_y and correlation coefficient rho, using the formula given above.
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 282
static VALUE
pdf_s_bivariate_gaussian(VALUE mod,VALUE v0,VALUE v1,VALUE v2,VALUE v3,VALUE v4)
{
double c2;
double c3;
double c4;
ndfunc_arg_in_t ain[2] = {{cDF,0},{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_bivariate_gaussian,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
2,1,ain,aout};
void *opt[3];
c2 = NUM2DBL(v2); opt[0] = &c2; //sigma_x
c3 = NUM2DBL(v3); opt[1] = &c3; //sigma_y
c4 = NUM2DBL(v4); opt[2] = &c4; //rho
return na_ndloop3(&ndf,opt,2,v0,v1);
}
|
.cauchy(x, a) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Cauchy distribution with scale parameter a, using the formula given above.
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 503
static VALUE
pdf_s_cauchy(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_cauchy,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //a
return na_ndloop3(&ndf,opt,1,v0);
}
|
.chisq(x, nu) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a chi-squared distribution with nu degrees of freedom, using the formula given above.
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 891
static VALUE
pdf_s_chisq(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_chisq,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //nu
return na_ndloop3(&ndf,opt,1,v0);
}
|
.dirichlet(alpha[], theta[], axis: nil, keepdims: false) ⇒ Numo::DFloat
This function computes the probability density $p(\theta_1, \ldots , \theta_K)$ p(\theta_1, … , \theta_K) at theta[K] for a Dirichlet distribution with parameters alpha[K], using the formula given above.
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1405
static VALUE
pdf_s_dirichlet(int argc, VALUE *argv, VALUE mod)
{
VALUE reduce;
ndfunc_arg_in_t ain[3] = {{cDF,0},{cDF,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = { iter_pdf_s_dirichlet, NDF_HAS_LOOP|NDF_FLAT_REDUCE|NDF_EXTRACT,
3, 1, ain, aout };
if (argc<2) {
rb_raise(rb_eArgError,"wrong number of argument (%d for >=2)",argc);
}
reduce = nary_reduce_dimension(argc-2, argv+2, 2, argv, &ndf, 0);
return na_ndloop(&ndf, 3, argv[0], argv[1], reduce);
}
|
.dirichlet_ln(alpha[], theta[], axis: nil, keepdims: false) ⇒ Numo::DFloat
This function computes the logarithm of the probability density $p(\theta_1, \ldots , \theta_K)$ p(\theta_1, … , \theta_K) for a Dirichlet distribution with parameters alpha[K].
1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1453
static VALUE
pdf_s_dirichlet_ln(int argc, VALUE *argv, VALUE mod)
{
VALUE reduce;
ndfunc_arg_in_t ain[3] = {{cDF,0},{cDF,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = { iter_pdf_s_dirichlet_ln, NDF_HAS_LOOP|NDF_FLAT_REDUCE|NDF_EXTRACT,
3, 1, ain, aout };
if (argc<2) {
rb_raise(rb_eArgError,"wrong number of argument (%d for >=2)",argc);
}
reduce = nary_reduce_dimension(argc-2, argv+2, 2, argv, &ndf, 0);
return na_ndloop(&ndf, 3, argv[0], argv[1], reduce);
}
|
.exponential(x, mu) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for an exponential distribution with mean mu, using the formula given above.
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 339
static VALUE
pdf_s_exponential(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_exponential,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //mu
return na_ndloop3(&ndf,opt,1,v0);
}
|
.exppow(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for an exponential power distribution with scale parameter a and exponent b, using the formula given above.
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 448
static VALUE
pdf_s_exppow(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_exppow,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.fdist(x, nu1, nu2) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for an F-distribution with nu1 and nu2 degrees of freedom, using the formula given above.
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 948
static VALUE
pdf_s_fdist(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_fdist,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //nu1
c2 = NUM2DBL(v2); opt[1] = &c2; //nu2
return na_ndloop3(&ndf,opt,1,v0);
}
|
.flat(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a uniform distribution from a to b, using the formula given above.
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 776
static VALUE
pdf_s_flat(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_flat,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.gamma(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a gamma distribution with parameters a and b, using the formula given above.
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 716
static VALUE
pdf_s_gamma(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_gamma,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.gaussian(x, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Gaussian distribution with standard deviation sigma, using the formula given above.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 62
static VALUE
pdf_s_gaussian(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_gaussian,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //sigma
return na_ndloop3(&ndf,opt,1,v0);
}
|
.gaussian_tail(x, a, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Gaussian tail distribution with standard deviation sigma and lower limit a, using the formula given above.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 163
static VALUE
pdf_s_gaussian_tail(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_gaussian_tail,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //sigma
return na_ndloop3(&ndf,opt,1,v0);
}
|
.geometric(k, p) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a geometric distribution with probability parameter p, using the formula given above.
1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1881
static VALUE
pdf_s_geometric(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_geometric,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //p
return na_ndloop3(&ndf,opt,1,v0);
}
|
.gumbel1(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Type-1 Gumbel distribution with parameters a and b, using the formula given above.
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1292
static VALUE
pdf_s_gumbel1(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_gumbel1,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.gumbel2(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Type-2 Gumbel distribution with parameters a and b, using the formula given above.
1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1352
static VALUE
pdf_s_gumbel2(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_gumbel2,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.hypergeometric(k, n1, n2, t) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a hypergeometric distribution with parameters n1, n2, t, using the formula given above.
1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1941
static VALUE
pdf_s_hypergeometric(VALUE mod,VALUE v0,VALUE v1,VALUE v2,VALUE v3)
{
unsigned int c1;
unsigned int c2;
unsigned int c3;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_hypergeometric,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[3];
c1 = NUM2UINT(v1); opt[0] = &c1; //n1
c2 = NUM2UINT(v2); opt[1] = &c2; //n2
c3 = NUM2UINT(v3); opt[2] = &c3; //t
return na_ndloop3(&ndf,opt,1,v0);
}
|
.landau(x) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for the Landau distribution using an approximation to the formula given above.
663 664 665 666 667 668 669 670 671 672 673 674 675 676 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 663
static VALUE
pdf_s_landau(VALUE mod,VALUE v0)
{
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_landau,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
return na_ndloop(&ndf,1,v0);
}
|
.laplace(x, a) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Laplace distribution with width a, using the formula given above.
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 391
static VALUE
pdf_s_laplace(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_laplace,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //a
return na_ndloop3(&ndf,opt,1,v0);
}
|
.logarithmic(k, p) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a logarithmic distribution with probability parameter p, using the formula given above.
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1998
static VALUE
pdf_s_logarithmic(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_logarithmic,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //p
return na_ndloop3(&ndf,opt,1,v0);
}
|
.logistic(x, a) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a logistic distribution with scale parameter a, using the formula given above.
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1115
static VALUE
pdf_s_logistic(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_logistic,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //a
return na_ndloop3(&ndf,opt,1,v0);
}
|
.lognormal(x, zeta, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a lognormal distribution with parameters zeta and sigma, using the formula given above.
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 836
static VALUE
pdf_s_lognormal(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_lognormal,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //zeta
c2 = NUM2DBL(v2); opt[1] = &c2; //sigma
return na_ndloop3(&ndf,opt,1,v0);
}
|
.multinomial(p[], n[], [axis0,axis1,..]) ⇒ Numo::DFloat
This function computes the probability $P(n_1, n_2, \ldots, n_K)$ P(n_1, n_2, …, n_K) of sampling n[K] from a multinomial distribution with parameters p[K], using the formula given above.
1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1665
static VALUE
pdf_s_multinomial(int argc, VALUE *argv, VALUE mod)
{
VALUE reduce;
ndfunc_arg_in_t ain[3] = {{cDF,0},{cUI,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = { iter_pdf_s_multinomial, NDF_HAS_LOOP|NDF_FLAT_REDUCE|NDF_EXTRACT,
3, 1, ain, aout };
if (argc<2) {
rb_raise(rb_eArgError,"wrong number of argument (%d for >=2)",argc);
}
reduce = nary_reduce_dimension(argc-2, argv+2, 2, argv, &ndf, 0);
return na_ndloop(&ndf, 3, argv[0], argv[1], reduce);
}
|
.multinomial_ln(p[], n[], [axis0,axis1,..]) ⇒ Numo::DFloat
This function returns the logarithm of the probability for the multinomial distribution $P(n_1, n_2, \ldots, n_K)$ P(n_1, n_2, …, n_K) with parameters p[K].
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1711
static VALUE
pdf_s_multinomial_ln(int argc, VALUE *argv, VALUE mod)
{
VALUE reduce;
ndfunc_arg_in_t ain[3] = {{cDF,0},{cUI,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = { iter_pdf_s_multinomial_ln, NDF_HAS_LOOP|NDF_FLAT_REDUCE|NDF_EXTRACT,
3, 1, ain, aout };
if (argc<2) {
rb_raise(rb_eArgError,"wrong number of argument (%d for >=2)",argc);
}
reduce = nary_reduce_dimension(argc-2, argv+2, 2, argv, &ndf, 0);
return na_ndloop(&ndf, 3, argv[0], argv[1], reduce);
}
|
.negative_binomial(k, p, n) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a negative binomial distribution with parameters p and n, using the formula given above.
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1766
static VALUE
pdf_s_negative_binomial(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_negative_binomial,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //p
c2 = NUM2DBL(v2); opt[1] = &c2; //n
return na_ndloop3(&ndf,opt,1,v0);
}
|
.pareto(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Pareto distribution with exponent a and scale b, using the formula given above.
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1172
static VALUE
pdf_s_pareto(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_pareto,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|
.pascal(k, p, n) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a Pascal distribution with parameters p and n, using the formula given above.
1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1826
static VALUE
pdf_s_pascal(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
unsigned int c2;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_pascal,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //p
c2 = NUM2UINT(v2); opt[1] = &c2; //n
return na_ndloop3(&ndf,opt,1,v0);
}
|
.poisson(k, mu) ⇒ Numo::DFloat
This function computes the probability p(k) of obtaining k from a Poisson distribution with mean mu, using the formula given above.
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1503
static VALUE
pdf_s_poisson(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cUI,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_poisson,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //mu
return na_ndloop3(&ndf,opt,1,v0);
}
|
.rayleigh(x, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Rayleigh distribution with scale parameter sigma, using the formula given above.
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 555
static VALUE
pdf_s_rayleigh(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_rayleigh,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //sigma
return na_ndloop3(&ndf,opt,1,v0);
}
|
.rayleigh_tail(x, a, sigma) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Rayleigh tail distribution with scale parameter sigma and lower limit a, using the formula given above.
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 612
static VALUE
pdf_s_rayleigh_tail(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_rayleigh_tail,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //sigma
return na_ndloop3(&ndf,opt,1,v0);
}
|
.tdist(x, nu) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a t-distribution with nu degrees of freedom, using the formula given above.
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1003
static VALUE
pdf_s_tdist(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_tdist,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //nu
return na_ndloop3(&ndf,opt,1,v0);
}
|
.ugaussian(x) ⇒ Numo::DFloat
These functions compute results for the unit Gaussian distribution. They are equivalent to the functions above with a standard deviation of one, sigma = 1.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 110
static VALUE
pdf_s_ugaussian(VALUE mod,VALUE v0)
{
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_ugaussian,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
return na_ndloop(&ndf,1,v0);
}
|
.ugaussian_tail(x, a) ⇒ Numo::DFloat
These functions compute results for the tail of a unit Gaussian distribution. They are equivalent to the functions above with a standard deviation of one, sigma = 1.
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 218
static VALUE
pdf_s_ugaussian_tail(VALUE mod,VALUE v0,VALUE v1)
{
double c1;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_ugaussian_tail,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt;
c1 = NUM2DBL(v1); opt = &c1; //a
return na_ndloop3(&ndf,opt,1,v0);
}
|
.weibull(x, a, b) ⇒ Numo::DFloat
This function computes the probability density p(x) at x for a Weibull distribution with scale a and exponent b, using the formula given above.
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 |
# File 'ext/numo/gsl/pdf/gsl_pdf.c', line 1232
static VALUE
pdf_s_weibull(VALUE mod,VALUE v0,VALUE v1,VALUE v2)
{
double c1;
double c2;
ndfunc_arg_in_t ain[1] = {{cDF,0}};
ndfunc_arg_out_t aout[1] = {{cDF,0}};
ndfunc_t ndf = {iter_pdf_s_weibull,NO_LOOP|NDF_INPLACE|NDF_EXTRACT,
1,1,ain,aout};
void *opt[2];
c1 = NUM2DBL(v1); opt[0] = &c1; //a
c2 = NUM2DBL(v2); opt[1] = &c2; //b
return na_ndloop3(&ndf,opt,1,v0);
}
|