Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)