MCPcopy Create free account
hub / github.com/numpy/numpy / test_minmax_blocked

Method test_minmax_blocked

numpy/core/tests/test_umath.py:2800–2819  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2798
2799class TestMinMax:
2800 def test_minmax_blocked(self):
2801 # simd tests on max/min, test all alignments, slow but important
2802 # for 2 * vz + 2 * (vs - 1) + 1 (unrolled once)
2803 for dt, sz in [(np.float32, 15), (np.float64, 7)]:
2804 for out, inp, msg in _gen_alignment_data(dtype=dt, type='unary',
2805 max_size=sz):
2806 for i in range(inp.size):
2807 inp[:] = np.arange(inp.size, dtype=dt)
2808 inp[i] = np.nan
2809 emsg = lambda: '%r\n%s' % (inp, msg)
2810 with suppress_warnings() as sup:
2811 sup.filter(RuntimeWarning,
2812 "invalid value encountered in reduce")
2813 assert_(np.isnan(inp.max()), msg=emsg)
2814 assert_(np.isnan(inp.min()), msg=emsg)
2815
2816 inp[i] = 1e10
2817 assert_equal(inp.max(), 1e10, err_msg=msg)
2818 inp[i] = -1e10
2819 assert_equal(inp.min(), -1e10, err_msg=msg)
2820
2821 def test_lower_align(self):
2822 # check data that is not aligned to element size

Callers

nothing calls this directly

Calls 7

_gen_alignment_dataFunction · 0.90
suppress_warningsClass · 0.90
assert_Function · 0.90
assert_equalFunction · 0.90
filterMethod · 0.80
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected