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

Method test_operators_comparison

numpy/core/tests/test_simd.py:1023–1038  ·  view source on GitHub ↗
(self, func, intrin)

Source from the content-addressed store, hash-verified

1021 (operator.eq, "cmpeq")
1022 ])
1023 def test_operators_comparison(self, func, intrin):
1024 if self._is_fp():
1025 data_a = self._data()
1026 else:
1027 data_a = self._data(self._int_max() - self.nlanes)
1028 data_b = self._data(self._int_min(), reverse=True)
1029 vdata_a, vdata_b = self.load(data_a), self.load(data_b)
1030 intrin = getattr(self, intrin)
1031
1032 mask_true = self._true_mask()
1033 def to_bool(vector):
1034 return [lane == mask_true for lane in vector]
1035
1036 data_cmp = [func(a, b) for a, b in zip(data_a, data_b)]
1037 cmp = to_bool(intrin(vdata_a, vdata_b))
1038 assert cmp == data_cmp
1039
1040 def test_operators_logical(self):
1041 if self._is_fp():

Callers

nothing calls this directly

Calls 6

_is_fpMethod · 0.80
_int_maxMethod · 0.80
_int_minMethod · 0.80
_true_maskMethod · 0.80
funcFunction · 0.50
_dataMethod · 0.45

Tested by

no test coverage detected