Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wgurecky committed Mar 13, 2024
1 parent 9de4190 commit 84089bf
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,33 @@ Example use:
[0.0],
];

let (res_x, err, iters) = gmres(a_test.as_ref(), b.as_ref(), x0.as_ref(), 10, 1e-8).unwrap();
// the final None arg means do not apply left preconditioning
let (res_x, err, iters) = gmres(a_test.as_ref(), b.as_ref(), x0.as_ref(), 10, 1e-8, None).unwrap();
println!("Result x: {:?}", res_x);
println!("Error x: {:?}", err);
println!("Iters : {:?}", iters);

## Preconditioned GMRES:

A preconditioner can be supplied:

// continued from above...
use faer_gmres::{JacobiPreconLinOp, LinOp};
let jacobi_pre = JacobiPreconLinOp::new(a_test.as_ref());
let (res_x, err, iters) = gmres(a_test.as_ref(), b.as_ref(), x0.as_ref(), 10, 1e-8, Some(&jacobi_pre)).unwrap();

## Restarted GMRES:

A restarted GMRES routine is provided:

use faer_gmres::restarted_gmres;
let max_inner = 30;
let max_outer = 50;
let (res_x, err, iters) = restarted_gmres(
a_test.as_ref(), b.as_ref(), x0.as_ref(), max_inner, max_outer, 1e-8, None).unwrap();

This will repeatedly call the inner GMRES routine, using the previous outer iteration's solution as the inital guess for the next outer solve. The current implementation of restarted GMRES in this package can reduce the memory requirements needed, but slow convergence.

TODO
====

Expand Down

0 comments on commit 84089bf

Please sign in to comment.