2 SUBROUTINE DHELS
(A
, LDA
, N
, Q
, B
)
4 DOUBLE PRECISION A
(LDA
,*), B
(*), Q
(*)
5 C-----------------------------------------------------------------------
6 C This is part of the LINPACK routine DGESL with changes
7 C due to the fact that A is an upper Hessenberg matrix.
8 C-----------------------------------------------------------------------
9 C DHELS solves the least squares problem
13 C using the factors computed by DHEQR.
17 C A DOUBLE PRECISION(LDA, N)
18 C the output from DHEQR which contains the upper
19 C triangular factor R in the QR decomposition of A.
22 C the leading dimension of the array A .
25 C A is originally an (N+1) by N matrix.
27 C Q DOUBLE PRECISION(2*N)
28 C The coefficients of the N givens rotations
29 C used in the QR factorization of A.
31 C B DOUBLE PRECISION(N+1)
32 C the right hand side vector.
36 C B the solution vector x .
38 C Modification of LINPACK, by Peter Brown, LLNL.
39 C Written 1/13/86. This version dated 6/20/01.
42 C-----------------------------------------------------------------------
43 INTEGER IQ
, K
, KB
, KP1
44 DOUBLE PRECISION C
, S
, T
, T1
, T2
46 C Minimize (b-A*x, b-A*x)
60 C Now solve R*x = Q*b.
66 CALL DAXPY
(K
-1, T
, A
(1,K
), 1, B
(1), 1)
69 C----------------------- End of Subroutine DHELS -----------------------