Skip to content

Commit

Permalink
TST: Relax test_trsm precision to 5 decimals
Browse files Browse the repository at this point in the history
And switch to triangular solver.

(backport of scipygh-7986)
  • Loading branch information
ilayn authored and rgommers committed Oct 17, 2017
1 parent 69c0d19 commit 9bcaf3f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scipy/linalg/tests/test_blas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
nonzero

from numpy.random import rand, seed
from scipy.linalg import _fblas as fblas, get_blas_funcs, toeplitz, solve
from scipy.linalg import _fblas as fblas, get_blas_funcs, toeplitz, solve, \
solve_triangular

try:
from scipy.linalg import _cblas as cblas
Expand Down Expand Up @@ -1030,6 +1031,7 @@ def test_b_overwrites(self):
def test_trsm():
seed(1234)
for ind, dtype in enumerate(DTYPES):
tol = np.finfo(dtype).eps*1000
func, = get_blas_funcs(('trsm',), dtype=dtype)

# Test protection against size mismatches
Expand All @@ -1052,26 +1054,26 @@ def test_trsm():
x1 = func(alpha=alpha, a=A, b=B1)
assert_equal(B1.shape, x1.shape)
x2 = solve(Au, alpha*B1)
assert_array_almost_equal(x1, x2)
assert_allclose(x1, x2, atol=tol)

x1 = func(alpha=alpha, a=A, b=B1, trans_a=1)
x2 = solve(Au.T, alpha*B1)
assert_array_almost_equal(x1, x2)
assert_allclose(x1, x2, atol=tol)

x1 = func(alpha=alpha, a=A, b=B1, trans_a=2)
x2 = solve(Au.conj().T, alpha*B1)
assert_array_almost_equal(x1, x2)
assert_allclose(x1, x2, atol=tol)

x1 = func(alpha=alpha, a=A, b=B1, diag=1)
Au[arange(m), arange(m)] = dtype(1)
x2 = solve(Au, alpha*B1)
assert_array_almost_equal(x1, x2)
assert_allclose(x1, x2, atol=tol)

x1 = func(alpha=alpha, a=A, b=B2, diag=1, side=1)
x2 = solve(Au.conj().T, alpha*B2.conj().T)
assert_array_almost_equal(x1, x2.conj().T)
assert_allclose(x1, x2.conj().T, atol=tol)

x1 = func(alpha=alpha, a=A, b=B2, diag=1, side=1, lower=1)
Al[arange(m), arange(m)] = dtype(1)
x2 = solve(Al.conj().T, alpha*B2.conj().T)
assert_array_almost_equal(x1, x2.conj().T)
assert_allclose(x1, x2.conj().T, atol=tol)

0 comments on commit 9bcaf3f

Please sign in to comment.