clc clear N = 100; A = randn(N); M = randn(N); b = randn(N, 1); tol = 10^(-7); max_it = 10*N; n_step = 4; n_max = 10*n_step; x = zeros(N, 1); r = b-A*x; Q = [r, sign(randn(N, n_max - 1))]; n = find_n(A, b, Q, M, n_step, n_max); [x, err, iter, flag] = mlbicgstab(A, x, b, Q(:, 1:n), M, max_it, tol);