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

Method test_var_dimensions

numpy/core/tests/test_multiarray.py:6303–6312  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6301 assert_almost_equal(res, tgt, decimal=ndec)
6302
6303 def test_var_dimensions(self):
6304 # _var paths for complex number introduce additions on views that
6305 # increase dimensions. Ensure this generalizes to higher dims
6306 mat = np.stack([self.cmat]*3)
6307 for axis in [0, 1, 2, -1, None]:
6308 msqr = _mean(mat * mat.conj(), axis=axis)
6309 mean = _mean(mat, axis=axis)
6310 tgt = msqr - mean * mean.conjugate()
6311 res = _var(mat, axis=axis)
6312 assert_almost_equal(res, tgt)
6313
6314 def test_var_complex_byteorder(self):
6315 # Test that var fast-path does not cause failures for complex arrays

Callers

nothing calls this directly

Calls 4

assert_almost_equalFunction · 0.90
conjugateMethod · 0.80
_meanFunction · 0.70
_varFunction · 0.70

Tested by

no test coverage detected