def test_solve_ones_range(): for dtype in DTYPES: b = np.arange(cram.N, dtype=dtype) mat = cram.ones(dtype=dtype) + 9 * sp.eye(cram.N, format="csr", dtype=dtype) obs = cram.solve(mat, b) exp = spla.spsolve(mat, b) yield assert_true, np.allclose(exp, obs)
def test_solve_identity_ones(): for dtype in DTYPES: b = np.ones(cram.N, dtype=dtype) mat = sp.eye(cram.N, format="csr", dtype=dtype) obs = cram.solve(mat, b) exp = spla.spsolve(mat, b) yield assert_true, np.allclose(exp, obs)
def test_solve_range_range(): for dtype in DTYPES: b = np.arange(cram.N, dtype=dtype) mat = cram.ones(dtype=dtype) + sp.diags( [b], offsets=[0], shape=(cram.N, cram.N), format="csr", dtype=dtype ) obs = cram.solve(mat, b) exp = spla.spsolve(mat, b) yield assert_true, np.allclose(exp, obs)