LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dorglq()

subroutine dorglq ( integer m,
integer n,
integer k,
double precision, dimension( lda, * ) a,
integer lda,
double precision, dimension( * ) tau,
double precision, dimension( * ) work,
integer lwork,
integer info )

DORGLQ

Download DORGLQ + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DORGLQ generates an M-by-N real matrix Q with orthonormal rows,
!> which is defined as the first M rows of a product of K elementary
!> reflectors of order N
!>
!>       Q  =  H(k) . . . H(2) H(1)
!>
!> as returned by DGELQF.
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix Q. M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix Q. N >= M.
!> 
[in]K
!>          K is INTEGER
!>          The number of elementary reflectors whose product defines the
!>          matrix Q. M >= K >= 0.
!> 
[in,out]A
!>          A is DOUBLE PRECISION array, dimension (LDA,N)
!>          On entry, the i-th row must contain the vector which defines
!>          the elementary reflector H(i), for i = 1,2,...,k, as returned
!>          by DGELQF in the first k rows of its array argument A.
!>          On exit, the M-by-N matrix Q.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The first dimension of the array A. LDA >= max(1,M).
!> 
[in]TAU
!>          TAU is DOUBLE PRECISION array, dimension (K)
!>          TAU(i) must contain the scalar factor of the elementary
!>          reflector H(i), as returned by DGELQF.
!> 
[out]WORK
!>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
!> 
[in]LWORK
!>          LWORK is INTEGER
!>          The dimension of the array WORK. LWORK >= max(1,M).
!>          For optimum performance LWORK >= M*NB, where NB is
!>          the optimal blocksize.
!>
!>          If LWORK = -1, then a workspace query is assumed; the routine
!>          only calculates the optimal size of the WORK array, returns
!>          this value as the first entry of the WORK array, and no error
!>          message related to LWORK is issued by XERBLA.
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument has an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 124 of file dorglq.f.

125*
126* -- LAPACK computational routine --
127* -- LAPACK is a software package provided by Univ. of Tennessee, --
128* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129*
130* .. Scalar Arguments ..
131 INTEGER INFO, K, LDA, LWORK, M, N
132* ..
133* .. Array Arguments ..
134 DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
135* ..
136*
137* =====================================================================
138*
139* .. Parameters ..
140 DOUBLE PRECISION ZERO
141 parameter( zero = 0.0d+0 )
142* ..
143* .. Local Scalars ..
144 LOGICAL LQUERY
145 INTEGER I, IB, IINFO, IWS, J, KI, KK, L, LDWORK,
146 $ LWKOPT, NB, NBMIN, NX
147* ..
148* .. External Subroutines ..
149 EXTERNAL dlarfb, dlarft, dorgl2, xerbla
150* ..
151* .. Intrinsic Functions ..
152 INTRINSIC max, min
153* ..
154* .. External Functions ..
155 INTEGER ILAENV
156 EXTERNAL ilaenv
157* ..
158* .. Executable Statements ..
159*
160* Test the input arguments
161*
162 info = 0
163 nb = ilaenv( 1, 'DORGLQ', ' ', m, n, k, -1 )
164 lwkopt = max( 1, m )*nb
165 work( 1 ) = lwkopt
166 lquery = ( lwork.EQ.-1 )
167 IF( m.LT.0 ) THEN
168 info = -1
169 ELSE IF( n.LT.m ) THEN
170 info = -2
171 ELSE IF( k.LT.0 .OR. k.GT.m ) THEN
172 info = -3
173 ELSE IF( lda.LT.max( 1, m ) ) THEN
174 info = -5
175 ELSE IF( lwork.LT.max( 1, m ) .AND. .NOT.lquery ) THEN
176 info = -8
177 END IF
178 IF( info.NE.0 ) THEN
179 CALL xerbla( 'DORGLQ', -info )
180 RETURN
181 ELSE IF( lquery ) THEN
182 RETURN
183 END IF
184*
185* Quick return if possible
186*
187 IF( m.LE.0 ) THEN
188 work( 1 ) = 1
189 RETURN
190 END IF
191*
192 nbmin = 2
193 nx = 0
194 iws = m
195 IF( nb.GT.1 .AND. nb.LT.k ) THEN
196*
197* Determine when to cross over from blocked to unblocked code.
198*
199 nx = max( 0, ilaenv( 3, 'DORGLQ', ' ', m, n, k, -1 ) )
200 IF( nx.LT.k ) THEN
201*
202* Determine if workspace is large enough for blocked code.
203*
204 ldwork = m
205 iws = ldwork*nb
206 IF( lwork.LT.iws ) THEN
207*
208* Not enough workspace to use optimal NB: reduce NB and
209* determine the minimum value of NB.
210*
211 nb = lwork / ldwork
212 nbmin = max( 2, ilaenv( 2, 'DORGLQ', ' ', m, n, k,
213 $ -1 ) )
214 END IF
215 END IF
216 END IF
217*
218 IF( nb.GE.nbmin .AND. nb.LT.k .AND. nx.LT.k ) THEN
219*
220* Use blocked code after the last block.
221* The first kk rows are handled by the block method.
222*
223 ki = ( ( k-nx-1 ) / nb )*nb
224 kk = min( k, ki+nb )
225*
226* Set A(kk+1:m,1:kk) to zero.
227*
228 DO 20 j = 1, kk
229 DO 10 i = kk + 1, m
230 a( i, j ) = zero
231 10 CONTINUE
232 20 CONTINUE
233 ELSE
234 kk = 0
235 END IF
236*
237* Use unblocked code for the last or only block.
238*
239 IF( kk.LT.m )
240 $ CALL dorgl2( m-kk, n-kk, k-kk, a( kk+1, kk+1 ), lda,
241 $ tau( kk+1 ), work, iinfo )
242*
243 IF( kk.GT.0 ) THEN
244*
245* Use blocked code
246*
247 DO 50 i = ki + 1, 1, -nb
248 ib = min( nb, k-i+1 )
249 IF( i+ib.LE.m ) THEN
250*
251* Form the triangular factor of the block reflector
252* H = H(i) H(i+1) . . . H(i+ib-1)
253*
254 CALL dlarft( 'Forward', 'Rowwise', n-i+1, ib, a( i,
255 $ i ),
256 $ lda, tau( i ), work, ldwork )
257*
258* Apply H**T to A(i+ib:m,i:n) from the right
259*
260 CALL dlarfb( 'Right', 'Transpose', 'Forward',
261 $ 'Rowwise',
262 $ m-i-ib+1, n-i+1, ib, a( i, i ), lda, work,
263 $ ldwork, a( i+ib, i ), lda, work( ib+1 ),
264 $ ldwork )
265 END IF
266*
267* Apply H**T to columns i:n of current block
268*
269 CALL dorgl2( ib, n-i+1, ib, a( i, i ), lda, tau( i ),
270 $ work,
271 $ iinfo )
272*
273* Set columns 1:i-1 of current block to zero
274*
275 DO 40 j = 1, i - 1
276 DO 30 l = i, i + ib - 1
277 a( l, j ) = zero
278 30 CONTINUE
279 40 CONTINUE
280 50 CONTINUE
281 END IF
282*
283 work( 1 ) = iws
284 RETURN
285*
286* End of DORGLQ
287*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
integer function ilaenv(ispec, name, opts, n1, n2, n3, n4)
ILAENV
Definition ilaenv.f:160
subroutine dlarfb(side, trans, direct, storev, m, n, k, v, ldv, t, ldt, c, ldc, work, ldwork)
DLARFB applies a block reflector or its transpose to a general rectangular matrix.
Definition dlarfb.f:195
recursive subroutine dlarft(direct, storev, n, k, v, ldv, tau, t, ldt)
DLARFT forms the triangular factor T of a block reflector H = I - vtvH
Definition dlarft.f:162
subroutine dorgl2(m, n, k, a, lda, tau, work, info)
DORGL2
Definition dorgl2.f:111
Here is the call graph for this function:
Here is the caller graph for this function: