MCPcopy
hub / github.com/numpy/numpy / test_p_non_contiguous

Method test_p_non_contiguous

numpy/random/tests/test_randomstate.py:172–180  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

170 assert_raises(ValueError, random.multinomial, -1, [0.8, 0.2])
171
172 def test_p_non_contiguous(self):
173 p = np.arange(15.)
174 p /= np.sum(p[1::3])
175 pvals = p[1::3]
176 rng = random.RandomState(1432985819)
177 non_contig = rng.multinomial(100, pvals=pvals)
178 rng = random.RandomState(1432985819)
179 contig = rng.multinomial(100, pvals=np.ascontiguousarray(pvals))
180 assert_array_equal(non_contig, contig)
181
182 def test_multinomial_pvals_float32(self):
183 x = np.array([9.9e-01, 9.9e-01, 1.0e-09, 1.0e-09, 1.0e-09, 1.0e-09,

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
sumMethod · 0.45

Tested by

no test coverage detected