MCPcopy Index your code
hub / github.com/numpy/numpy / test_minmax_blocked

Method test_minmax_blocked

numpy/_core/tests/test_umath.py:3091–3112  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3089
3090class TestMinMax:
3091 def test_minmax_blocked(self):
3092 # simd tests on max/min, test all alignments, slow but important
3093 # for 2 * vz + 2 * (vs - 1) + 1 (unrolled once)
3094 for dt, sz in [(np.float32, 15), (np.float64, 7)]:
3095 for out, inp, msg in _gen_alignment_data(dtype=dt, type='unary',
3096 max_size=sz):
3097 for i in range(inp.size):
3098 inp[:] = np.arange(inp.size, dtype=dt)
3099 inp[i] = np.nan
3100 emsg = lambda: f'{inp!r}\n{msg}'
3101 with warnings.catch_warnings():
3102 warnings.filterwarnings(
3103 'ignore',
3104 "invalid value encountered in reduce",
3105 RuntimeWarning)
3106 assert_(np.isnan(inp.max()), msg=emsg)
3107 assert_(np.isnan(inp.min()), msg=emsg)
3108
3109 inp[i] = 1e10
3110 assert_equal(inp.max(), 1e10, err_msg=msg)
3111 inp[i] = -1e10
3112 assert_equal(inp.min(), -1e10, err_msg=msg)
3113
3114 def test_lower_align(self):
3115 # check data that is not aligned to element size

Callers

nothing calls this directly

Calls 5

_gen_alignment_dataFunction · 0.90
assert_Function · 0.90
assert_equalFunction · 0.90
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected