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

Method do

numpy/linalg/tests/test_linalg.py:854–870  ·  view source on GitHub ↗
(self, a, b, tags)

Source from the content-addressed store, hash-verified

852class DetCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase):
853
854 def do(self, a, b, tags):
855 d = linalg.det(a)
856 res = linalg.slogdet(a)
857 s, ld = res.sign, res.logabsdet
858 if asarray(a).dtype.type in (single, double):
859 ad = asarray(a).astype(double)
860 else:
861 ad = asarray(a).astype(cdouble)
862 ev = linalg.eigvals(ad)
863 assert_almost_equal(d, multiply.reduce(ev, axis=-1))
864 assert_almost_equal(s * np.exp(ld), multiply.reduce(ev, axis=-1))
865
866 s = np.atleast_1d(s)
867 ld = np.atleast_1d(ld)
868 m = (s != 0)
869 assert_almost_equal(np.abs(s[m]), 1)
870 assert_equal(ld[~m], -inf)
871
872
873class TestDet(DetCases):

Callers

nothing calls this directly

Calls 5

asarrayFunction · 0.90
assert_almost_equalFunction · 0.90
assert_equalFunction · 0.90
astypeMethod · 0.80
reduceMethod · 0.45

Tested by

no test coverage detected