The SVSOL function uses “back-substitution” to solve a set of simultaneous linear equations Ax = b, given the U, W, and V arrays returned by the SVDC procedure. None of the input arguments are modified, making it possible to call SVSOL multiple times with different right hand vectors, B.
; Define the array A:
A = [[1.0, 2.0, -1.0, 2.5], $
[1.5, 3.3, -0.5, 2.0], $
[3.1, 0.7, 2.2, 0.0], $
[0.0, 0.3, -2.0, 5.3], $
[2.1, 1.0, 4.3, 2.2], $
[0.0, 5.5, 3.8, 0.2]]
; Define the right-hand side vector B:
B = [0.0, 1.0, 5.3, -2.0, 6.3, 3.8]
; Decompose A:
SVDC, A, W, U, V
; Compute the solution and print the result:
PRINT, SVSOL(U, W, V, B)
1.00095 0.00881170 0.984176 -0.0100954
This is the correct solution.
Returns the solution to the linear system using decomposition and back substitution.
An n-column, m-row orthogonal array used in the decomposition of A. Normally, U is returned from the SVDC procedure.
An n-element vector containing “singular values.” Normally, W is returned from the SVDC procedure. Small values (close to machine floating-point precision) should be set to zero prior to calling SVSOL.
An n-column, n-row orthogonal array used in the decomposition of A. Normally, V is returned from the SVDC procedure.
An m-element vector containing the right hand side of the linear system Ax = b.
Set this keyword if the input arrays U and V are in column-major format (composed of column vectors) rather than in row-major format (composed of row vectors).
Set this keyword to force the computation to be done in double-precision arithmetic.
Resources and References
SVSOL is based on the routine svbksb described in section 2.6 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.