Skip to content

Commit

Permalink
Merge pull request #3 from wgurecky/restarted_precon_test
Browse files Browse the repository at this point in the history
New test for restarted gmres with preconditioning
  • Loading branch information
wgurecky authored Mar 14, 2024
2 parents d9dc63c + fc776d9 commit 850bbd3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,19 @@ mod test_faer_gmres {
assert_approx_eq!(res_x.read(2, 0), -0.657575, 1e-4);
assert_approx_eq!(res_x.read(3, 0), -0.181680, 1e-4);
assert_approx_eq!(res_x.read(4, 0), 0.292447, 1e-4);

// with preconditioning
let jacobi_pre = JacobiPreconLinOp::new(a_test.as_ref());
let (res_x_precon, err_precon, iters_precon) = restarted_gmres(
a_test.as_ref(), b.as_ref(), x0.as_ref(), 3, 30,
1e-6, Some(&jacobi_pre)).unwrap();
assert!(iters_precon < iters);
assert!(err_precon < 1e-4);
assert_approx_eq!(res_x_precon.read(0, 0), 0.037919, 1e-4);
assert_approx_eq!(res_x_precon.read(1, 0), 0.888551, 1e-4);
assert_approx_eq!(res_x_precon.read(2, 0), -0.657575, 1e-4);
assert_approx_eq!(res_x_precon.read(3, 0), -0.181680, 1e-4);
assert_approx_eq!(res_x_precon.read(4, 0), 0.292447, 1e-4);
}

#[test]
Expand Down

0 comments on commit 850bbd3

Please sign in to comment.