Skip to content

Commit 2bd4a14

Browse files
committed
Fix relative residual formula in tests
1 parent 5bc9f99 commit 2bd4a14

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/test_sparse_solvers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
The relative residual can be defined as:
1313
|| A * x - b ||
1414
η = ---------------------
15-
||A||*||x|| + ||b||
15+
||b||
1616
1717
Typically, the expected value for this quantity is:
1818
* Ideally: 1e-12 - 1e-14

xobjects/sparse/_test_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def rel_residual(A,x,b):
2121
b = b.get()
2222
assert issparse(A), ("A must be a sparse matrix")
2323

24-
return npl.norm(A@x - b) / (scspl.norm(A)*npl.norm(x) + npl.norm(b))
24+
return npl.norm(A@x - b) / (npl.norm(b))
2525

2626
def assert_residual_ok(res_ref, res_solver,
2727
abs_tol=1e-12,

0 commit comments

Comments
 (0)