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

Method test_square

numpy/core/tests/test_simd.py:421–434  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

419 assert sqrt == data_sqrt
420
421 def test_square(self):
422 pinf, ninf, nan = self._pinfinity(), self._ninfinity(), self._nan()
423 data = self._data()
424 vdata = self.load(self._data())
425 # square
426 square_cases = ((nan, nan), (pinf, pinf), (ninf, pinf))
427 for case, desired in square_cases:
428 data_square = [desired]*self.nlanes
429 square = self.square(self.setall(case))
430 assert square == pytest.approx(data_square, nan_ok=True)
431
432 data_square = [x*x for x in data]
433 square = self.square(vdata)
434 assert square == data_square
435
436 @pytest.mark.parametrize("intrin, func", [("ceil", math.ceil),
437 ("trunc", math.trunc), ("floor", math.floor), ("rint", round)])

Callers

nothing calls this directly

Calls 4

_pinfinityMethod · 0.80
_ninfinityMethod · 0.80
_nanMethod · 0.80
_dataMethod · 0.45

Tested by

no test coverage detected