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

Method test_square

numpy/_core/tests/test_simd.py:428–441  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

426 assert sqrt == data_sqrt
427
428 def test_square(self):
429 pinf, ninf, nan = self._pinfinity(), self._ninfinity(), self._nan()
430 data = self._data()
431 vdata = self.load(self._data())
432 # square
433 square_cases = ((nan, nan), (pinf, pinf), (ninf, pinf))
434 for case, desired in square_cases:
435 data_square = [desired] * self.nlanes
436 square = self.square(self.setall(case))
437 assert square == pytest.approx(data_square, nan_ok=True)
438
439 data_square = [x * x for x in data]
440 square = self.square(vdata)
441 assert square == data_square
442
443 @pytest.mark.parametrize("intrin, func", [("ceil", math.ceil),
444 ("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