BiCGStab, GMRES: Rearranged residual calculation to remove temporaries.
The use of y -= prod(A, x) is troublesome for matrix-free applications, hence the residual calculation residual = rhs; residual -= prod(A, current_guess); was modified to residual = prod(A, current_guess); residual = rhs - residual; to circumvent the problem. As an extra benefit, this also improves performance since our current implementation of y -= prod(A, x) for sparse matrices A relies on a temporary for prod(A, x).
Loading
Please register or sign in to comment