The LINBCG function is used in conjunction with SPRSIN to solve a set of n linear equations with n unknowns using the iterative biconjugate gradient method. The result is an n -element vector.
LINBCG is based on the routine
linbcg
described in section 2.7 of
Numerical Recipes in C: The Art of Scientific Computing
(Second Edition), published by Cambridge University Press, and is used by permission.
Note: Numerical Recipes recommends using double-precision arithmetic to perform this computation.
Use this keyword to specify which convergence test should be used. Set ITOL to one of the following:
Use this keyword to specify the desired convergence tolerance. For single-precision calculations, the default value is 1.0 ¥ 10^{ -7} . For double-precision values, the default is 1.0 ¥ 10^{ -14} .
A = [[ 5.0, 0.0, 0.0, 1.0, -2.0], $
[ 3.0, -2.0, 0.0, 1.0, 0.0], $
[ 4.0, -1.0, 0.0, 2.0, 0.0], $
B = [7.0, 1.0, 3.0, 3.0, -4.0] ; Define a right-hand side vector B.
X = REPLICATE(1.0, N_ELEMENTS(B)) ; Start with an initial guess at the solution.
result = LINBCG(SPRSIN(A), B, X)
;
Solve the linear system Ax=b.
PRINT, result ; Print the result.