Skip to content

Commit

Permalink
rtol
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasyVR committed Nov 14, 2022
1 parent 060e703 commit 97ade0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/python/test_sparse_linear_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ def init_b(b: ti.types.ndarray(), nrows: ti.i32):
# solve Ax=b using numpy
b_np = b.to_numpy()
x_np = np.linalg.solve(A_psd, b_np)
assert (np.allclose(x_ti.to_numpy(), x_np, rtol=1.0e-2))
assert (np.allclose(x_ti.to_numpy(), x_np, rtol=5.0e-3))

# solve Ax=b using cusolver refectorization
solver = ti.linalg.SparseSolver()
solver.analyze_pattern(A_ti)
solver.factorize(A_ti)
x_ti = solver.solve(b)
ti.sync()
assert (np.allclose(x_ti.to_numpy(), x_np, rtol=1.0e-2))
assert (np.allclose(x_ti.to_numpy(), x_np, rtol=5.0e-3))

# solve Ax = b using compute function
solver = ti.linalg.SparseSolver()
solver.compute(A_ti)
x_cti = solver.solve(b)
ti.sync()
assert (np.allclose(x_cti.to_numpy(), x_np, rtol=1.0e-2))
assert (np.allclose(x_cti.to_numpy(), x_np, rtol=5.0e-3))

0 comments on commit 97ade0b

Please sign in to comment.