def test_leftright_precond(self):

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=SparseEfficiencyWarning)
            from scipy.sparse.linalg.dsolve import splu
            from scipy.sparse.linalg.interface import LinearOperator

            n = 100

            dat = ones(n)
            A = spdiags([-2*dat, 4*dat, -dat], [-1,0,1],n,n)
            b = arange(n,dtype='d')

            L = spdiags([-dat/2, dat], [-1,0], n, n)
            U = spdiags([4*dat, -dat], [0,1], n, n)

            L_solver = splu(L)
            U_solver = splu(U)

            def L_solve(b):
                return L_solver.solve(b)

            def U_solve(b):
                return U_solver.solve(b)

            def LT_solve(b):
                return L_solver.solve(b,'T')

            def UT_solve(b):
                return U_solver.solve(b,'T')

            M1 = LinearOperator((n,n), matvec=L_solve, rmatvec=LT_solve)
            M2 = LinearOperator((n,n), matvec=U_solve, rmatvec=UT_solve)

            x,info = qmr(A, b, tol=1e-8, maxiter=15, M1=M1, M2=M2)

            assert_equal(info,0)
            assert_normclose(A*x, b, tol=1e-8)
Upload large files using Amazon's multipart upload functionality.
dataset/ETHPy150Open scipy/scipy/scipy/sparse/linalg/isolve/tests/test_iterative.py/TestQMR.test_leftright_precond--crossover with--dataset/ETHPy150Open chapmanb/cloudbiolinux/utils/s3_multipart_upload.py/_multipart_upload