Problem with qrfac and Qrsolv(for least square) [message #57051] |
Fri, 30 November 2007 14:53 |
coold
Messages: 8 Registered: December 2004
|
Junior Member |
|
|
I was trying to solve a constrained least square problem with qrfac
and qrsolv but it stops at
idiag = lindgen(minmn)
r(idiag, idiag) = rdiag
I am wondering if I am making any mistake as I really would like to
use the QRdecomp routine.
************************************************
IDL>.run leastsq_decomp
IDL>leastsq_qrdecomp
pro leastsq_qrdecomp
;solve the equation A## X = B, in the least squares sense, where:
;A=[3,4] B=[4,1] ;;SIZE OF MATRICES
A = [[1,2,2],$
[4,5,6],$
[7,8,9],$
[1,1,1]]
print, A
B = [[1],[3],[5],[1]]
print, B
qrfac, a, r, ipvt, /PIVOT
x = qrsolv(a, r, b, PIVOTS=ipvt)
print, x
end
Thanks.
|
|
|