LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
dgelqs.f
Go to the documentation of this file.
1 *> \brief \b DGELQS
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE DGELQS( M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK,
12 * INFO )
13 *
14 * .. Scalar Arguments ..
15 * INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
16 * ..
17 * .. Array Arguments ..
18 * DOUBLE PRECISION A( LDA, * ), B( LDB, * ), TAU( * ),
19 * $ WORK( LWORK )
20 * ..
21 *
22 *
23 *> \par Purpose:
24 * =============
25 *>
26 *> \verbatim
27 *>
28 *> Compute a minimum-norm solution
29 *> min || A*X - B ||
30 *> using the LQ factorization
31 *> A = L*Q
32 *> computed by DGELQF.
33 *> \endverbatim
34 *
35 * Arguments:
36 * ==========
37 *
38 *> \param[in] M
39 *> \verbatim
40 *> M is INTEGER
41 *> The number of rows of the matrix A. M >= 0.
42 *> \endverbatim
43 *>
44 *> \param[in] N
45 *> \verbatim
46 *> N is INTEGER
47 *> The number of columns of the matrix A. N >= M >= 0.
48 *> \endverbatim
49 *>
50 *> \param[in] NRHS
51 *> \verbatim
52 *> NRHS is INTEGER
53 *> The number of columns of B. NRHS >= 0.
54 *> \endverbatim
55 *>
56 *> \param[in] A
57 *> \verbatim
58 *> A is DOUBLE PRECISION array, dimension (LDA,N)
59 *> Details of the LQ factorization of the original matrix A as
60 *> returned by DGELQF.
61 *> \endverbatim
62 *>
63 *> \param[in] LDA
64 *> \verbatim
65 *> LDA is INTEGER
66 *> The leading dimension of the array A. LDA >= M.
67 *> \endverbatim
68 *>
69 *> \param[in] TAU
70 *> \verbatim
71 *> TAU is DOUBLE PRECISION array, dimension (M)
72 *> Details of the orthogonal matrix Q.
73 *> \endverbatim
74 *>
75 *> \param[in,out] B
76 *> \verbatim
77 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
78 *> On entry, the m-by-nrhs right hand side matrix B.
79 *> On exit, the n-by-nrhs solution matrix X.
80 *> \endverbatim
81 *>
82 *> \param[in] LDB
83 *> \verbatim
84 *> LDB is INTEGER
85 *> The leading dimension of the array B. LDB >= N.
86 *> \endverbatim
87 *>
88 *> \param[out] WORK
89 *> \verbatim
90 *> WORK is DOUBLE PRECISION array, dimension (LWORK)
91 *> \endverbatim
92 *>
93 *> \param[in] LWORK
94 *> \verbatim
95 *> LWORK is INTEGER
96 *> The length of the array WORK. LWORK must be at least NRHS,
97 *> and should be at least NRHS*NB, where NB is the block size
98 *> for this environment.
99 *> \endverbatim
100 *>
101 *> \param[out] INFO
102 *> \verbatim
103 *> INFO is INTEGER
104 *> = 0: successful exit
105 *> < 0: if INFO = -i, the i-th argument had an illegal value
106 *> \endverbatim
107 *
108 * Authors:
109 * ========
110 *
111 *> \author Univ. of Tennessee
112 *> \author Univ. of California Berkeley
113 *> \author Univ. of Colorado Denver
114 *> \author NAG Ltd.
115 *
116 *> \date November 2011
117 *
118 *> \ingroup double_lin
119 *
120 * =====================================================================
121  SUBROUTINE dgelqs( M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK,
122  $ info )
123 *
124 * -- LAPACK test routine (version 3.4.0) --
125 * -- LAPACK is a software package provided by Univ. of Tennessee, --
126 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
127 * November 2011
128 *
129 * .. Scalar Arguments ..
130  INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
131 * ..
132 * .. Array Arguments ..
133  DOUBLE PRECISION A( lda, * ), B( ldb, * ), TAU( * ),
134  $ work( lwork )
135 * ..
136 *
137 * =====================================================================
138 *
139 * .. Parameters ..
140  DOUBLE PRECISION ZERO, ONE
141  parameter ( zero = 0.0d+0, one = 1.0d+0 )
142 * ..
143 * .. External Subroutines ..
144  EXTERNAL dlaset, dormlq, dtrsm, xerbla
145 * ..
146 * .. Intrinsic Functions ..
147  INTRINSIC max
148 * ..
149 * .. Executable Statements ..
150 *
151 * Test the input parameters.
152 *
153  info = 0
154  IF( m.LT.0 ) THEN
155  info = -1
156  ELSE IF( n.LT.0 .OR. m.GT.n ) THEN
157  info = -2
158  ELSE IF( nrhs.LT.0 ) THEN
159  info = -3
160  ELSE IF( lda.LT.max( 1, m ) ) THEN
161  info = -5
162  ELSE IF( ldb.LT.max( 1, n ) ) THEN
163  info = -8
164  ELSE IF( lwork.LT.1 .OR. lwork.LT.nrhs .AND. m.GT.0 .AND. n.GT.0 )
165  $ THEN
166  info = -10
167  END IF
168  IF( info.NE.0 ) THEN
169  CALL xerbla( 'DGELQS', -info )
170  RETURN
171  END IF
172 *
173 * Quick return if possible
174 *
175  IF( n.EQ.0 .OR. nrhs.EQ.0 .OR. m.EQ.0 )
176  $ RETURN
177 *
178 * Solve L*X = B(1:m,:)
179 *
180  CALL dtrsm( 'Left', 'Lower', 'No transpose', 'Non-unit', m, nrhs,
181  $ one, a, lda, b, ldb )
182 *
183 * Set B(m+1:n,:) to zero
184 *
185  IF( m.LT.n )
186  $ CALL dlaset( 'Full', n-m, nrhs, zero, zero, b( m+1, 1 ), ldb )
187 *
188 * B := Q' * B
189 *
190  CALL dormlq( 'Left', 'Transpose', n, nrhs, m, a, lda, tau, b, ldb,
191  $ work, lwork, info )
192 *
193  RETURN
194 *
195 * End of DGELQS
196 *
197  END
subroutine dlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: dlaset.f:112
subroutine dormlq(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
DORMLQ
Definition: dormlq.f:169
subroutine dtrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
DTRSM
Definition: dtrsm.f:183
subroutine dgelqs(M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK, INFO)
DGELQS
Definition: dgelqs.f:123
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62