QRSOLV Name
QRSOLV
Author
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov Purpose
Solve a linear equation after performing QR factorization
Major Topics
Linear Systems
Calling Sequence
X = QRSOLV(A, R, B, PIVOTS=IPVT) Description
The procedure QRSOLV completes the solution of a linear equation,
A ## x = B
after the MxN matrix has been factorized by QR decomposition.
After being factorized once using QRFAC, the matrices can be used
for multiple righthand sides (i.e., different B's).
The solution technique is to first compute the factorization using
QRFAC, which yields the orthogonal matrix Q and the upper
triangular matrix R. [ Actually, Q is represented by its
Householder reflectors. ] Then the solution vector, X, is computed
using QRSOLV.
If pivoting was performed in the factorization, the permutation
vector IPVT returned by QRFAC must also be passed to QRSOLV.
Parameters
A - upon input, the factorized matrix A, returned by QRFAC.
R - upon input, the upper diagonal matrix R, returned by QRFAC.
B - upon input, the righthand vector B, which fits into the
equation, A ## x = B
X - upon ouptut, the solution vector X, to the above linear
equation. For an overdetermined system, X is the least
squares solution which minimizes TOTAL( (A ## X - B)^2 ).
Keyword Parameters
PIVOTS - upon input, the permutation matrix IPVT returned by
QRFAC, if pivoting is to be performed.
Example
Solve the equation A ## X = B, in the least squares sense, where:
A = [[1.0,1.0,1.0,1.0,1.0,1.0],$
[0.6,0.8,0.5,0.8,0.7,0.9],$
[0.2,0.3,0.1,0.4,0.3,0.4]]
and B = [0.57E,0.69,0.5,0.7,0.6,0.8]
qrfac, a, r, ipvt, /PIVOT
x = qrsolv(a, r, b, PIVOTS=ipvt)
print, x
0.0834092 0.852273 -0.179545
References
More', Jorge J., "The Levenberg-Marquardt Algorithm:
Implementation and Theory," in *Numerical Analysis*, ed. Watson,
G. A., Lecture Notes in Mathematics 630, Springer-Verlag, 1977.
Modification History
Written (taken from MPFIT), CM, Feb 2002
Usage message, error checking, CM, 15 Mar 2002
Error checking is fixed, CM, 10 May 2002
Found error in return of permuted results, CM, 21 May 2004