SVBKSB Procedure
Uses “back substitution” to solve the set of simultaneous linear equations Ax = b, given the u, w, and v arrays created by the SVD procedure from the matrix a.
Usage
SVBKSB, u, w, v, b, x
Input Parameters
u—The m-by-n column matrix of the decomposition of a, as returned by SVD.
w—The vector of singular values, as returned by SVD.
v—The n-by-n orthogonal matrix of the decomposition of A, as returned by SVD.
b—The vector containing the right-hand side of the equation.
Output Parameters
x—A variable containing the result.
Keywords
None.
Discussion
Since no input quantities are destroyed, SVBKSB may be called numerous times with different b vectors.
Example
Here’s a typical use of SVD and SVBKSB to solve the system Ax = b:
; Decompose square matrix A.
s = 0
A = RANDOMU(s, 3, 3) * 10.0
SVD, A, w, u, v
; Get subscripts of singular values, using a given threshold.
small = WHERE(w LT MAX(w) * 1.0e-6, count)
; Zero singular values less than the threshold.
; See the Numerical Recipes book for details.
b = [0.375, 0.612, 0.457]
IF count NE 0 THEN w(small) = 0.0
; The vector x now contains the solution.
SVBKSB, u, w, v, b, x
; The residual, |Ax - b| should be near 0.
PRINT, TOTAL(ABS(A # x - b)), Format='(F20.16)'
See Also
SVBKSB is based on the routine of the same name in Numerical Recipes in C: The Art of Scientific Computing, by Flannery, Press, Teukolsky, and Vetterling, Cambridge University Press, Cambridge, MA, 1988. It is used by permission.