c_distributions.pxd 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!python
  2. #cython: wraparound=False, nonecheck=False, boundscheck=False, cdivision=True, language_level=3
  3. from numpy cimport npy_intp
  4. from libc.stdint cimport (uint64_t, int32_t, int64_t)
  5. from numpy.random cimport bitgen_t
  6. cdef extern from "numpy/random/distributions.h":
  7. struct s_binomial_t:
  8. int has_binomial
  9. double psave
  10. int64_t nsave
  11. double r
  12. double q
  13. double fm
  14. int64_t m
  15. double p1
  16. double xm
  17. double xl
  18. double xr
  19. double c
  20. double laml
  21. double lamr
  22. double p2
  23. double p3
  24. double p4
  25. ctypedef s_binomial_t binomial_t
  26. double random_standard_uniform(bitgen_t *bitgen_state) nogil
  27. void random_standard_uniform_fill(bitgen_t* bitgen_state, npy_intp cnt, double *out) nogil
  28. double random_standard_exponential(bitgen_t *bitgen_state) nogil
  29. double random_standard_exponential_f(bitgen_t *bitgen_state) nogil
  30. void random_standard_exponential_fill(bitgen_t *bitgen_state, npy_intp cnt, double *out) nogil
  31. void random_standard_exponential_fill_f(bitgen_t *bitgen_state, npy_intp cnt, double *out) nogil
  32. void random_standard_exponential_inv_fill(bitgen_t *bitgen_state, npy_intp cnt, double *out) nogil
  33. void random_standard_exponential_inv_fill_f(bitgen_t *bitgen_state, npy_intp cnt, double *out) nogil
  34. double random_standard_normal(bitgen_t* bitgen_state) nogil
  35. void random_standard_normal_fill(bitgen_t *bitgen_state, npy_intp count, double *out) nogil
  36. void random_standard_normal_fill_f(bitgen_t *bitgen_state, npy_intp count, float *out) nogil
  37. double random_standard_gamma(bitgen_t *bitgen_state, double shape) nogil
  38. float random_standard_uniform_f(bitgen_t *bitgen_state) nogil
  39. void random_standard_uniform_fill_f(bitgen_t* bitgen_state, npy_intp cnt, float *out) nogil
  40. float random_standard_normal_f(bitgen_t* bitgen_state) nogil
  41. float random_standard_gamma_f(bitgen_t *bitgen_state, float shape) nogil
  42. int64_t random_positive_int64(bitgen_t *bitgen_state) nogil
  43. int32_t random_positive_int32(bitgen_t *bitgen_state) nogil
  44. int64_t random_positive_int(bitgen_t *bitgen_state) nogil
  45. uint64_t random_uint(bitgen_t *bitgen_state) nogil
  46. double random_normal(bitgen_t *bitgen_state, double loc, double scale) nogil
  47. double random_gamma(bitgen_t *bitgen_state, double shape, double scale) nogil
  48. float random_gamma_f(bitgen_t *bitgen_state, float shape, float scale) nogil
  49. double random_exponential(bitgen_t *bitgen_state, double scale) nogil
  50. double random_uniform(bitgen_t *bitgen_state, double lower, double range) nogil
  51. double random_beta(bitgen_t *bitgen_state, double a, double b) nogil
  52. double random_chisquare(bitgen_t *bitgen_state, double df) nogil
  53. double random_f(bitgen_t *bitgen_state, double dfnum, double dfden) nogil
  54. double random_standard_cauchy(bitgen_t *bitgen_state) nogil
  55. double random_pareto(bitgen_t *bitgen_state, double a) nogil
  56. double random_weibull(bitgen_t *bitgen_state, double a) nogil
  57. double random_power(bitgen_t *bitgen_state, double a) nogil
  58. double random_laplace(bitgen_t *bitgen_state, double loc, double scale) nogil
  59. double random_gumbel(bitgen_t *bitgen_state, double loc, double scale) nogil
  60. double random_logistic(bitgen_t *bitgen_state, double loc, double scale) nogil
  61. double random_lognormal(bitgen_t *bitgen_state, double mean, double sigma) nogil
  62. double random_rayleigh(bitgen_t *bitgen_state, double mode) nogil
  63. double random_standard_t(bitgen_t *bitgen_state, double df) nogil
  64. double random_noncentral_chisquare(bitgen_t *bitgen_state, double df,
  65. double nonc) nogil
  66. double random_noncentral_f(bitgen_t *bitgen_state, double dfnum,
  67. double dfden, double nonc) nogil
  68. double random_wald(bitgen_t *bitgen_state, double mean, double scale) nogil
  69. double random_vonmises(bitgen_t *bitgen_state, double mu, double kappa) nogil
  70. double random_triangular(bitgen_t *bitgen_state, double left, double mode,
  71. double right) nogil
  72. int64_t random_poisson(bitgen_t *bitgen_state, double lam) nogil
  73. int64_t random_negative_binomial(bitgen_t *bitgen_state, double n, double p) nogil
  74. int64_t random_binomial(bitgen_t *bitgen_state, double p, int64_t n, binomial_t *binomial) nogil
  75. int64_t random_logseries(bitgen_t *bitgen_state, double p) nogil
  76. int64_t random_geometric_search(bitgen_t *bitgen_state, double p) nogil
  77. int64_t random_geometric_inversion(bitgen_t *bitgen_state, double p) nogil
  78. int64_t random_geometric(bitgen_t *bitgen_state, double p) nogil
  79. int64_t random_zipf(bitgen_t *bitgen_state, double a) nogil
  80. int64_t random_hypergeometric(bitgen_t *bitgen_state, int64_t good, int64_t bad,
  81. int64_t sample) nogil
  82. uint64_t random_interval(bitgen_t *bitgen_state, uint64_t max) nogil
  83. # Generate random uint64 numbers in closed interval [off, off + rng].
  84. uint64_t random_bounded_uint64(bitgen_t *bitgen_state,
  85. uint64_t off, uint64_t rng,
  86. uint64_t mask, bint use_masked) nogil
  87. void random_multinomial(bitgen_t *bitgen_state, int64_t n, int64_t *mnix,
  88. double *pix, npy_intp d, binomial_t *binomial) nogil
  89. int random_multivariate_hypergeometric_count(bitgen_t *bitgen_state,
  90. int64_t total,
  91. size_t num_colors, int64_t *colors,
  92. int64_t nsample,
  93. size_t num_variates, int64_t *variates) nogil
  94. void random_multivariate_hypergeometric_marginals(bitgen_t *bitgen_state,
  95. int64_t total,
  96. size_t num_colors, int64_t *colors,
  97. int64_t nsample,
  98. size_t num_variates, int64_t *variates) nogil