fn pcg<T: PcgElem>(
a: impl FnMut(&[T], &mut [T]),
b: &[T],
tol: f64,
maxit: usize,
start: Start<'_, T>,
n_logical: usize,
on: Option<&Support>,
) -> PcgOut<T>Expand description
MATLAB R2023b’s pcg(A, b, tol, maxit, [], [], x0) (no preconditioner), line for line.
The vectors have n_logical elements; with on, only those in that set are stored (the
others are zero in every vector of the solve: A maps such vectors to such vectors and b
is one), and the norms and inner products add the same terms as over the whole vector.
MATLAB’s xmin is copied only when it stops being the current iterate (XMin), so the
result is the same with one vector less while they coincide; and a returned iter of an
xmin that is the last iterate is imin (the two candidates are then the same vector).