示例#1
0
def test_numpy_dense_solvers(numpy_dense_solver):
    op = NumpyMatrixOperator(np.eye(10) * np.arange(1, 11))
    rhs = NumpyVectorArray(np.ones(10))
    solution = op.apply_inverse(rhs, options=numpy_dense_solver)
    assert ((op.apply(solution) - rhs).l2_norm() / rhs.l2_norm())[0] < 1e-8
示例#2
0
def test_numpy_sparse_solvers(numpy_sparse_solver):
    op = NumpyMatrixOperator(diags([np.arange(1., 11.)], [0]))
    rhs = NumpyVectorArray(np.ones(10))
    solution = op.apply_inverse(rhs, options=numpy_sparse_solver)
    assert ((op.apply(solution) - rhs).l2_norm() / rhs.l2_norm())[0] < 1e-8
示例#3
0
def test_generic_solvers(generic_solver):
    op = GenericOperator()
    rhs = NumpyVectorArray(np.ones(10))
    solution = op.apply_inverse(rhs, options=generic_solver)
    assert ((op.apply(solution) - rhs).l2_norm() / rhs.l2_norm())[0] < 1e-8