Rev 84031 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
cc dqrfit is a subroutine to compute least squares solutionsc to the systemcc (1) x * b = ycc which may be either under-determined or over-determined.c the user must supply a tolerance to limit the columns ofc x used in computing the solution. in effect, a set ofc columns with a condition number approximately bounded byc 1/tol is used, the other components of b being set to zero.cc on entrycc x double precision(n,p).c x contains n-by-p coefficient matrix ofc the system (1), x is destroyed by dqrfit.cc n the number of rows of the matrix x.cc p the number of columns of the matrix x.cc y double precision(n,ny)c y contains the right hand side(s) of the system (1).cc ny the number of right hand sides of the system (1).cc tol double precisionc tol is the nonnegative tolerance used toc determine the subset of columns of x includedc in the solution. columns are pivoted out ofc decomposition ifcc jpvt integer(p)c the values in jpvt are permuted in the samec way as the columns of x. this can be usefulc in unscrambling coefficients etc.cc work double precision(2*p)c work is an array used by dqrdc2 and dqrsl.cc on returncc x contains the output array from dqrdc2.c namely the qr decomposition of x stored inc compact form.cc b double precision(p,ny)c b contains the solution vectors with rows permutedc in the same way as the columns of x. componentsc corresponding to columns not used are set to zero.cc rsd double precision(n,ny)c rsd contains the residual vectors y-x*b.cc qty double precision(n,ny) tc qty contains the vectors q y. note thatc the initial p elements of this vector arec permuted in the same way as the columns of x.cc k integerc k contains the number of columns used in thec solution.cc jpvt has its contents permuted as described above.cc qraux double precision(p)c qraux contains auxiliary information on thec qr decomposition of x.ccc on return the arrays x, jpvt and qraux contain thec usual output from dqrdc, so that the qr decompositionc of x with pivoting is fully available to the user.c in particular, columns jpvt(1), jpvt(2),...,jpvt(k)c were used in the solution, and the condition numberc associated with those columns is estimated byc abs(x(1,1)/x(k,k)).cc dqrfit uses the linpack routines dqrdc and dqrsl.csubroutine dqrls(x,n,p,y,ny,tol,b,rsd,qty,k,jpvt,qraux,work)integer n,p,ny,k,jpvt(p)double precision x(n,p),y(n,ny),tol,b(p,ny),rsd(n,ny),. qty(n,ny),qraux(p),work(2*p)cc internal variables.cinteger info,i,j,jj,kkcc reduce x.ccall dqrdc2(x,n,n,p,tol,k,qraux,jpvt,work)cc solve the truncated least squares problem for each rhs.cif(k .gt. 0) thendo 20 jj=1,nycall dqrsl(x,n,n,k,qraux,y(1,jj),rsd(1,jj),qty(1,jj),1 b(1,jj),rsd(1,jj),rsd(1,jj),1110,info)20 continueelsedo 35 i=1,ndo 30 jj=1,nyrsd(i,jj) = y(i,jj)30 continue35 continueendifcc set the unused components of b to zero.ckk = k + 1do 50 j=kk,pdo 40 jj=1,nyb(j,jj) = 0.d040 continue50 continuereturnend