10000 TST: fixed test for gufuncs_linalg Det · numpy/numpy@e41e426 · GitHub
[go: up one dir, main page]

Skip to content

Commit e41e426

Browse files
ovillellaspv
ovillellas
authored andcommitted
TST: fixed test for gufuncs_linalg Det
1 parent 76a1963 commit e41e426

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

numpy/core/tests/test_gufuncs_linalg.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@
6767

6868
old_assert_almost_equal = assert_almost_equal
6969

70-
_highp = {
71-
single: double,
72-
double: double,
73-
csingle: cdouble,
74-
cdouble: cdouble
75-
}
76-
7770
def assert_almost_equal(a, b, **kw):
7871
if a.dtype.type in (single, csingle):
7972
decimal = 5
@@ -253,9 +246,16 @@ def do(self, a, b):
253246
assert_almost_equal(s * np.exp(ld), d)
254247
# use eigvals in high-precision. This way problems in the complex single
255248
# test is avoided as eigvals fails in there.
256-
ev = gula.eigvals(a.astype(_highp[a.dtype.type])).astype(a.dtype.type)
257-
assert_almost_equal(d, multiply.reduce(ev, axis=(ev.ndim-1)))
258-
assert_almost_equal(s * np.exp(ld), multiply.reduce(ev, axis=(ev.ndim-1)))
249+
# also note that in gufuncs_linalg eigvals for reals return complex
250+
if np.csingle == a.dtype.type or np.single == a.dtype.type:
251+
cmp_type=np.csingle
252+
else:
253+
cmp_type=np.cdouble
254+
255+
ev = gula.eigvals(a.astype(np.cdouble))
256+
assert_almost_equal(d.astype(cmp_type),
257+
multiply.reduce(ev.astype(cmp_type),
258+
axis=(ev.ndim-1)))
259259
if s != 0:
260260
assert_almost_equal(np.abs(s), 1)
261261
else:

0 commit comments

Comments
 (0)
0