c_distributions.pxd 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. float random_standard_uniform_f(bitgen_t *bitgen_state) nogil
  27. double random_standard_uniform(bitgen_t *bitgen_state) nogil
  28. void random_standard_uniform_fill(bitgen_t* bitgen_state, npy_intp cnt, double *out) nogil
  29. void random_standard_uniform_fill_f(bitgen_t *bitgen_state, npy_intp cnt, float *out) nogil
  30. double random_standard_exponential(bitgen_t *bitgen_state) nogil
  31. float random_standard_exponential_f(bitgen_t *bitgen_state) nogil
  32. void random_standard_exponential_fill(bitgen_t *bitgen_state, npy_intp cnt, double *out) nogil
  33. void random_standard_exponential_fill_f(bitgen_t *bitgen_state, npy_intp cnt, float *out) nogil
  34. void random_standard_exponential_inv_fill(bitgen_t *bitgen_state, npy_intp cnt, double *out) nogil
  35. void random_standard_exponential_inv_fill_f(bitgen_t *bitgen_state, npy_intp cnt, float *out) nogil
  36. double random_standard_normal(bitgen_t* bitgen_state) nogil
  37. float random_standard_normal_f(bitgen_t *bitgen_state) nogil
  38. void random_standard_normal_fill(bitgen_t *bitgen_state, npy_intp count, double *out) nogil
  39. void random_standard_normal_fill_f(bitgen_t *bitgen_state, npy_intp count, float *out) nogil
  40. double random_standard_gamma(bitgen_t *bitgen_state, double shape) nogil
  41. float random_standard_gamma_f(bitgen_t *bitgen_state, float shape) nogil
  42. float random_standard_uniform_f(bitgen_t *bitgen_state) nogil
  43. void random_standard_uniform_fill_f(bitgen_t* bitgen_state, npy_intp cnt, float *out) nogil
  44. float random_standard_normal_f(bitgen_t* bitgen_state) nogil
  45. float random_standard_gamma_f(bitgen_t *bitgen_state, float shape) nogil
  46. int64_t random_positive_int64(bitgen_t *bitgen_state) nogil
  47. int32_t random_positive_int32(bitgen_t *bitgen_state) nogil
  48. int64_t random_positive_int(bitgen_t *bitgen_state) nogil
  49. uint64_t random_uint(bitgen_t *bitgen_state) nogil
  50. double random_normal(bitgen_t *bitgen_state, double loc, double scale) nogil
  51. double random_gamma(bitgen_t *bitgen_state, double shape, double scale) nogil
  52. float random_gamma_f(bitgen_t *bitgen_state, float shape, float scale) nogil
  53. double random_exponential(bitgen_t *bitgen_state, double scale) nogil
  54. double random_uniform(bitgen_t *bitgen_state, double lower, double range) nogil
  55. double random_beta(bitgen_t *bitgen_state, double a, double b) nogil
  56. double random_chisquare(bitgen_t *bitgen_state, double df) nogil
  57. double random_f(bitgen_t *bitgen_state, double dfnum, double dfden) nogil
  58. double random_standard_cauchy(bitgen_t *bitgen_state) nogil
  59. double random_pareto(bitgen_t *bitgen_state, double a) nogil
  60. double random_weibull(bitgen_t *bitgen_state, double a) nogil
  61. double random_power(bitgen_t *bitgen_state, double a) nogil
  62. double random_laplace(bitgen_t *bitgen_state, double loc, double scale) nogil
  63. double random_gumbel(bitgen_t *bitgen_state, double loc, double scale) nogil
  64. double random_logistic(bitgen_t *bitgen_state, double loc, double scale) nogil
  65. double random_lognormal(bitgen_t *bitgen_state, double mean, double sigma) nogil
  66. double random_rayleigh(bitgen_t *bitgen_state, double mode) nogil
  67. double random_standard_t(bitgen_t *bitgen_state, double df) nogil
  68. double random_noncentral_chisquare(bitgen_t *bitgen_state, double df,
  69. double nonc) nogil
  70. double random_noncentral_f(bitgen_t *bitgen_state, double dfnum,
  71. double dfden, double nonc) nogil
  72. double random_wald(bitgen_t *bitgen_state, double mean, double scale) nogil
  73. double random_vonmises(bitgen_t *bitgen_state, double mu, double kappa) nogil
  74. double random_triangular(bitgen_t *bitgen_state, double left, double mode,
  75. double right) nogil
  76. int64_t random_poisson(bitgen_t *bitgen_state, double lam) nogil
  77. int64_t random_negative_binomial(bitgen_t *bitgen_state, double n, double p) nogil
  78. int64_t random_binomial(bitgen_t *bitgen_state, double p, int64_t n, binomial_t *binomial) nogil
  79. int64_t random_logseries(bitgen_t *bitgen_state, double p) nogil
  80. int64_t random_geometric_search(bitgen_t *bitgen_state, double p) nogil
  81. int64_t random_geometric_inversion(bitgen_t *bitgen_state, double p) nogil
  82. int64_t random_geometric(bitgen_t *bitgen_state, double p) nogil
  83. int64_t random_zipf(bitgen_t *bitgen_state, double a) nogil
  84. int64_t random_hypergeometric(bitgen_t *bitgen_state, int64_t good, int64_t bad,
  85. int64_t sample) nogil
  86. uint64_t random_interval(bitgen_t *bitgen_state, uint64_t max) nogil
  87. # Generate random uint64 numbers in closed interval [off, off + rng].
  88. uint64_t random_bounded_uint64(bitgen_t *bitgen_state,
  89. uint64_t off, uint64_t rng,
  90. uint64_t mask, bint use_masked) nogil
  91. void random_multinomial(bitgen_t *bitgen_state, int64_t n, int64_t *mnix,
  92. double *pix, npy_intp d, binomial_t *binomial) nogil
  93. int random_multivariate_hypergeometric_count(bitgen_t *bitgen_state,
  94. int64_t total,
  95. size_t num_colors, int64_t *colors,
  96. int64_t nsample,
  97. size_t num_variates, int64_t *variates) nogil
  98. void random_multivariate_hypergeometric_marginals(bitgen_t *bitgen_state,
  99. int64_t total,
  100. size_t num_colors, int64_t *colors,
  101. int64_t nsample,
  102. size_t num_variates, int64_t *variates) nogil