@@ -11,6 +11,7 @@ import numpy as np
1111cimport numpy as np
1212from numpy .core .multiarray import normalize_axis_index
1313
14+ from .c_distributions cimport *
1415from libc cimport string
1516from libc .stdint cimport (uint8_t , uint16_t , uint32_t , uint64_t ,
1617 int32_t , int64_t , INT64_MAX , SIZE_MAX )
@@ -26,117 +27,8 @@ from ._common cimport (POISSON_LAM_MAX, CONS_POSITIVE, CONS_NONE,
2627 check_array_constraint , check_constraint , disc , discrete_broadcast_iii ,
2728 )
2829
29-
30- cdef extern from "numpy/random/distributions.h" :
31-
32- struct s_binomial_t :
33- int has_binomial
34- double psave
35- int64_t nsave
36- double r
37- double q
38- double fm
39- int64_t m
40- double p1
41- double xm
42- double xl
43- double xr
44- double c
45- double laml
46- double lamr
47- double p2
48- double p3
49- double p4
50-
51- ctypedef s_binomial_t binomial_t
52-
53- double random_standard_uniform (bitgen_t * bitgen_state ) nogil
54- void random_standard_uniform_fill (bitgen_t * bitgen_state , np .npy_intp cnt , double * out ) nogil
55- double random_standard_exponential (bitgen_t * bitgen_state ) nogil
56- double random_standard_exponential_f (bitgen_t * bitgen_state ) nogil
57- void random_standard_exponential_fill (bitgen_t * bitgen_state , np .npy_intp cnt , double * out ) nogil
58- void random_standard_exponential_fill_f (bitgen_t * bitgen_state , np .npy_intp cnt , double * out ) nogil
59- void random_standard_exponential_inv_fill (bitgen_t * bitgen_state , np .npy_intp cnt , double * out ) nogil
60- void random_standard_exponential_inv_fill_f (bitgen_t * bitgen_state , np .npy_intp cnt , double * out ) nogil
61- double random_standard_normal (bitgen_t * bitgen_state ) nogil
62- void random_standard_normal_fill (bitgen_t * bitgen_state , np .npy_intp count , double * out ) nogil
63- void random_standard_normal_fill_f (bitgen_t * bitgen_state , np .npy_intp count , float * out ) nogil
64- double random_standard_gamma (bitgen_t * bitgen_state , double shape ) nogil
65-
66- float random_standard_uniform_f (bitgen_t * bitgen_state ) nogil
67- void random_standard_uniform_fill_f (bitgen_t * bitgen_state , np .npy_intp cnt , float * out ) nogil
68- float random_standard_normal_f (bitgen_t * bitgen_state ) nogil
69- float random_standard_gamma_f (bitgen_t * bitgen_state , float shape ) nogil
70-
71- int64_t random_positive_int64 (bitgen_t * bitgen_state ) nogil
72- int32_t random_positive_int32 (bitgen_t * bitgen_state ) nogil
73- int64_t random_positive_int (bitgen_t * bitgen_state ) nogil
74- uint64_t random_uint (bitgen_t * bitgen_state ) nogil
75-
76- double random_normal (bitgen_t * bitgen_state , double loc , double scale ) nogil
77-
78- double random_gamma (bitgen_t * bitgen_state , double shape , double scale ) nogil
79- float random_gamma_f (bitgen_t * bitgen_state , float shape , float scale ) nogil
80-
81- double random_exponential (bitgen_t * bitgen_state , double scale ) nogil
82- double random_uniform (bitgen_t * bitgen_state , double lower , double range ) nogil
83- double random_beta (bitgen_t * bitgen_state , double a , double b ) nogil
84- double random_chisquare (bitgen_t * bitgen_state , double df ) nogil
85- double random_f (bitgen_t * bitgen_state , double dfnum , double dfden ) nogil
86- double random_standard_cauchy (bitgen_t * bitgen_state ) nogil
87- double random_pareto (bitgen_t * bitgen_state , double a ) nogil
88- double random_weibull (bitgen_t * bitgen_state , double a ) nogil
89- double random_power (bitgen_t * bitgen_state , double a ) nogil
90- double random_laplace (bitgen_t * bitgen_state , double loc , double scale ) nogil
91- double random_gumbel (bitgen_t * bitgen_state , double loc , double scale ) nogil
92- double random_logistic (bitgen_t * bitgen_state , double loc , double scale ) nogil
93- double random_lognormal (bitgen_t * bitgen_state , double mean , double sigma ) nogil
94- double random_rayleigh (bitgen_t * bitgen_state , double mode ) nogil
95- double random_standard_t (bitgen_t * bitgen_state , double df ) nogil
96- double random_noncentral_chisquare (bitgen_t * bitgen_state , double df ,
97- double nonc ) nogil
98- double random_noncentral_f (bitgen_t * bitgen_state , double dfnum ,
99- double dfden , double nonc ) nogil
100- double random_wald (bitgen_t * bitgen_state , double mean , double scale ) nogil
101- double random_vonmises (bitgen_t * bitgen_state , double mu , double kappa ) nogil
102- double random_triangular (bitgen_t * bitgen_state , double left , double mode ,
103- double right ) nogil
104-
105- int64_t random_poisson (bitgen_t * bitgen_state , double lam ) nogil
106- int64_t random_negative_binomial (bitgen_t * bitgen_state , double n , double p ) nogil
107- int64_t random_binomial (bitgen_t * bitgen_state , double p , int64_t n , binomial_t * binomial ) nogil
108- int64_t random_logseries (bitgen_t * bitgen_state , double p ) nogil
109- int64_t random_geometric_search (bitgen_t * bitgen_state , double p ) nogil
110- int64_t random_geometric_inversion (bitgen_t * bitgen_state , double p ) nogil
111- int64_t random_geometric (bitgen_t * bitgen_state , double p ) nogil
112- int64_t random_zipf (bitgen_t * bitgen_state , double a ) nogil
113- int64_t random_hypergeometric (bitgen_t * bitgen_state , int64_t good , int64_t bad ,
114- int64_t sample ) nogil
115-
116- uint64_t random_interval (bitgen_t * bitgen_state , uint64_t max ) nogil
117-
118- # Generate random uint64 numbers in closed interval [off, off + rng].
119- uint64_t random_bounded_uint64 (bitgen_t * bitgen_state ,
120- uint64_t off , uint64_t rng ,
121- uint64_t mask , bint use_masked ) nogil
122-
123- void random_multinomial (bitgen_t * bitgen_state , int64_t n , int64_t * mnix ,
124- double * pix , np .npy_intp d , binomial_t * binomial ) nogil
125-
126- int random_multivariate_hypergeometric_count (bitgen_t * bitgen_state ,
127- int64_t total ,
128- size_t num_colors , int64_t * colors ,
129- int64_t nsample ,
130- size_t num_variates , int64_t * variates ) nogil
131- void random_multivariate_hypergeometric_marginals (bitgen_t * bitgen_state ,
132- int64_t total ,
133- size_t num_colors , int64_t * colors ,
134- int64_t nsample ,
135- size_t num_variates , int64_t * variates ) nogil
136-
13730np .import_array ()
13831
139-
14032cdef int64_t _safe_sum_nonneg_int64 (size_t num_colors , int64_t * colors ):
14133 """
14234 Sum the values in the array `colors`.
0 commit comments