nidtec-una / krysbas-dev

A collection of Krylov Subspace-Based Adaptive Solvers (KrySBAS) written in MATLAB
https://krysbas-dev.readthedocs.io
GNU General Public License v3.0
2 stars 1 forks source link

BUG: GMRES-E failing for a small system #68

Closed jhabriel closed 4 days ago

jhabriel commented 2 weeks ago

MWE

% Setup a trivial linear system
A = eye(3);
b = [2; 3; 4];

% Setup GMRES-E
m = 2;
k = 1;
tol = 1e-9;
maxit = 100;

% Call GMRES-E
[x, flag, relresvec, time] = gmres_e(A, b, m, k, tol, maxit, []);

Raised error:

Index in position 2 exceeds array bounds. Index must not exceed 1.

Error in gmres_e (line 243)
    Rs = HUpTri(1:s, 1:s);
jccf19 commented 1 week ago

For the test matrix, there is a GMRES Breakdown in the first iteration, the Modified Gram Schmidt-Arnoldi must be adjusted, see proposition 6.10 of the book Iterative Methods for Sparse Linear Systems (Second Edition) by Yused Saad.