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

Method test_var_complex_values

numpy/_core/tests/test_multiarray.py:7259–7268  ·  view source on GitHub ↗
(self, complex_dtype, ndec)

Source from the content-addressed store, hash-verified

7257 ('clongdouble', 7),
7258 ))
7259 def test_var_complex_values(self, complex_dtype, ndec):
7260 _, cmat, _ = self._create_data()
7261 # Test fast-paths for every builtin complex type
7262 for axis in [0, 1, None]:
7263 mat = cmat.copy().astype(complex_dtype)
7264 msqr = _mean(mat * mat.conj(), axis=axis)
7265 mean = _mean(mat, axis=axis)
7266 tgt = msqr - mean * mean.conjugate()
7267 res = _var(mat, axis=axis)
7268 assert_almost_equal(res, tgt, decimal=ndec)
7269
7270 def test_var_dimensions(self):
7271 # _var paths for complex number introduce additions on views that

Callers

nothing calls this directly

Calls 7

_create_dataMethod · 0.95
assert_almost_equalFunction · 0.90
astypeMethod · 0.80
conjugateMethod · 0.80
_meanFunction · 0.70
_varFunction · 0.70
copyMethod · 0.45

Tested by

no test coverage detected