Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

bicgstabl - Biconjugate gradients stabilized (l) method

Syntax

x = bicgstabl(A,b)
x = bicgstabl(afun,b)
x = bicgstabl(A,b,tol)
x = bicgstabl(A,b,tol,maxit)
x = bicgstabl(A,b,tol,maxit,M)
x = bicgstabl(A,b,tol,maxit,M1,M2)
x = bicgstabl(A,b,tol,maxit,M1,M2,x0)
[x,flag] = bicgstabl(A,b,...)
[x,flag,relres] = bicgstabl(A,b,...)
[x,flag,relres,iter] = bicgstabl(A,b,...)
[x,flag,relres,iter,resvec] = bicgstabl(A,b,...)

Description

x = bicgstabl(A,b) attempts to solve the system of linear equations A*x=b for x. The n-by-n coefficient matrix A must be square and the right-hand side column vector b must have length n.

x = bicgstabl(afun,b) accepts a function handle afun instead of the matrix A. afun(x) accepts a vector input x and returns the matrix-vector product A*x. In all of the following syntaxes, you can replace A by afun.

x = bicgstabl(A,b,tol) specifies the tolerance of the method. If tol is [] then bicgstabl uses the default, 1e-6.

x = bicgstabl(A,b,tol,maxit) specifies the maximum number of iterations. If maxit is [] then bicgstabl uses the default, min(N,20).

x = bicgstabl(A,b,tol,maxit,M) and x = bicgstabl(A,b,tol,maxit,M1,M2) use preconditioner M or M=M1*M2 and effectively solve the system A*inv(M)*x = b for x. If M is [] then a preconditioner is not applied. M may be a function handle returning M\x.

x = bicgstabl(A,b,tol,maxit,M1,M2,x0) specifies the initial guess. If x0 is [] then bicgstabl uses the default, an all zero vector.

[x,flag] = bicgstabl(A,b,...) also returns a convergence flag:

Flag

Convergence

0

bicgstabl converged to the desired tolerance tol within maxit iterations.

1

bicgstabl iterated maxit times but did not converge.

2

Preconditioner M was ill-conditioned.

3

bicgstabl stagnated. (Two consecutive iterates were the same.)

4

One of the scalar quantities calculated during bicgstabl became too small or too large to continue computing.

[x,flag,relres] = bicgstabl(A,b,...) also returns the relative residual norm(b-A*x)/norm(b). If flag is 0, relres <= tol.

[x,flag,relres,iter] = bicgstabl(A,b,...) also returns the iteration number at which x was computed, where 0 <= iter <= maxit. iter can be k/4 where k is some integer, indicating convergence at a given quarter iteration.

[x,flag,relres,iter,resvec] = bicgstabl(A,b,...) also returns a vector of the residual norms at each quarter iteration, including norm(b-A*x0).

Example

n = 21; 
A = gallery('wilk',n);  
b = sum(A,2);
tol = 1e-12;  
maxit = 15; 
M = diag([10:-1:1 1 1:10]);
x = bicgstabl(A,b,tol,maxit,M);

You can also use this matrix-vector product function:

function y = afun(x,n)
y = [0; x(1:n-1)] + [((n-1)/2:-1:0)';
(1:(n-1)/2)'].*x+[x(2:n); 0];

and this preconditioner backsolve function:

function y = mfun(r,n)
y = r ./ [((n-1)/2:-1:1)';
1; 
(1:(n-1)/2)'];

as inputs to bicgstabl:

x1 = bicgstabl(@(x)afun(x,n),b,tol,maxit,@(x)mfun(x,n));

See Also

bicgstab, bicg, cgs, gmres, lsqr, luinc, minres, pcg, qmr, symmlq, function_handle (@), mldivide (\)

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS