@@ -78,7 +78,7 @@ cpdef _sample_without_replacement_with_tracking_selection(
78
78
79
79
cdef cnp.int_t i
80
80
cdef cnp.int_t j
81
- cdef cnp.ndarray[cnp. int_t, ndim=1 ] out = np. empty(( n_samples, ) , dtype=int)
81
+ cdef cnp.int_t[: ] out = np. empty(( n_samples, ) , dtype=int)
82
82
83
83
rng = check_random_state( random_state)
84
84
rng_randint = rng. randint
@@ -94,7 +94,7 @@ cpdef _sample_without_replacement_with_tracking_selection(
94
94
selected. add( j)
95
95
out[i ] = j
96
96
97
- return out
97
+ return np . asarray ( out)
98
98
99
99
100
100
cpdef _sample_without_replacement_with_pool( cnp. int_t n_population,
@@ -133,9 +133,9 @@ cpdef _sample_without_replacement_with_pool(cnp.int_t n_population,
133
133
134
134
cdef cnp.int_t i
135
135
cdef cnp.int_t j
136
- cdef cnp.ndarray[cnp. int_t, ndim=1 ] out = np.empty((n_samples, ), dtype=int)
136
+ cdef cnp.int_t[: ] out = np.empty((n_samples, ), dtype=int)
137
137
138
- cdef cnp.ndarray[cnp. int_t, ndim=1 ] pool = np.empty((n_population, ),
138
+ cdef cnp.int_t[: ] pool = np.empty((n_population, ),
139
139
dtype=int)
140
140
141
141
rng = check_random_state(random_state)
@@ -153,7 +153,7 @@ cpdef _sample_without_replacement_with_pool(cnp.int_t n_population,
153
153
pool[j] = pool[n_population - i - 1] # move non-selected item into
154
154
# vacancy
155
155
156
- return out
156
+ return np.asarray( out)
157
157
158
158
159
159
cpdef _sample_without_replacement_with_reservoir_sampling(
@@ -195,7 +195,7 @@ cpdef _sample_without_replacement_with_reservoir_sampling(
195
195
196
196
cdef cnp.int_t i
197
197
cdef cnp.int_t j
198
- cdef cnp.ndarray[cnp. int_t, ndim=1 ] out = np.empty((n_samples, ), dtype=int)
198
+ cdef cnp.int_t[: ] out = np.empty((n_samples, ), dtype=int)
199
199
200
200
rng = check_random_state(random_state)
201
201
rng_randint = rng.randint
@@ -212,7 +212,7 @@ cpdef _sample_without_replacement_with_reservoir_sampling(
212
212
if j < n_samples:
213
213
out[j] = i
214
214
215
- return out
215
+ return np.asarray( out)
216
216
217
217
218
218
cpdef sample_without_replacement(cnp.int_t n_population,
0 commit comments