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

◆ dorgbr()

subroutine dorgbr ( character vect,
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 )

DORGBR

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

Purpose:
!>
!> DORGBR generates one of the real orthogonal matrices Q or P**T
!> determined by DGEBRD when reducing a real matrix A to bidiagonal
!> form: A = Q * B * P**T.  Q and P**T are defined as products of
!> elementary reflectors H(i) or G(i) respectively.
!>
!> If VECT = 'Q', A is assumed to have been an M-by-K matrix, and Q
!> is of order M:
!> if m >= k, Q = H(1) H(2) . . . H(k) and DORGBR returns the first n
!> columns of Q, where m >= n >= k;
!> if m < k, Q = H(1) H(2) . . . H(m-1) and DORGBR returns Q as an
!> M-by-M matrix.
!>
!> If VECT = 'P', A is assumed to have been a K-by-N matrix, and P**T
!> is of order N:
!> if k < n, P**T = G(k) . . . G(2) G(1) and DORGBR returns the first m
!> rows of P**T, where n >= m >= k;
!> if k >= n, P**T = G(n-1) . . . G(2) G(1) and DORGBR returns P**T as
!> an N-by-N matrix.
!> 
Parameters
[in]VECT
!>          VECT is CHARACTER*1
!>          Specifies whether the matrix Q or the matrix P**T is
!>          required, as defined in the transformation applied by DGEBRD:
!>          = 'Q':  generate Q;
!>          = 'P':  generate P**T.
!> 
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix Q or P**T to be returned.
!>          M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix Q or P**T to be returned.
!>          N >= 0.
!>          If VECT = 'Q', M >= N >= min(M,K);
!>          if VECT = 'P', N >= M >= min(N,K).
!> 
[in]K
!>          K is INTEGER
!>          If VECT = 'Q', the number of columns in the original M-by-K
!>          matrix reduced by DGEBRD.
!>          If VECT = 'P', the number of rows in the original K-by-N
!>          matrix reduced by DGEBRD.
!>          K >= 0.
!> 
[in,out]A
!>          A is DOUBLE PRECISION array, dimension (LDA,N)
!>          On entry, the vectors which define the elementary reflectors,
!>          as returned by DGEBRD.
!>          On exit, the M-by-N matrix Q or P**T.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A. LDA >= max(1,M).
!> 
[in]TAU
!>          TAU is DOUBLE PRECISION array, dimension
!>                                (min(M,K)) if VECT = 'Q'
!>                                (min(N,K)) if VECT = 'P'
!>          TAU(i) must contain the scalar factor of the elementary
!>          reflector H(i) or G(i), which determines Q or P**T, as
!>          returned by DGEBRD in its array argument TAUQ or TAUP.
!> 
[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,min(M,N)).
!>          For optimum performance LWORK >= min(M,N)*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 had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 154 of file dorgbr.f.

156*
157* -- LAPACK computational routine --
158* -- LAPACK is a software package provided by Univ. of Tennessee, --
159* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
160*
161* .. Scalar Arguments ..
162 CHARACTER VECT
163 INTEGER INFO, K, LDA, LWORK, M, N
164* ..
165* .. Array Arguments ..
166 DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
167* ..
168*
169* =====================================================================
170*
171* .. Parameters ..
172 DOUBLE PRECISION ZERO, ONE
173 parameter( zero = 0.0d+0, one = 1.0d+0 )
174* ..
175* .. Local Scalars ..
176 LOGICAL LQUERY, WANTQ
177 INTEGER I, IINFO, J, LWKOPT, MN
178* ..
179* .. External Functions ..
180 LOGICAL LSAME
181 EXTERNAL lsame
182* ..
183* .. External Subroutines ..
184 EXTERNAL dorglq, dorgqr, xerbla
185* ..
186* .. Intrinsic Functions ..
187 INTRINSIC max, min
188* ..
189* .. Executable Statements ..
190*
191* Test the input arguments
192*
193 info = 0
194 wantq = lsame( vect, 'Q' )
195 mn = min( m, n )
196 lquery = ( lwork.EQ.-1 )
197 IF( .NOT.wantq .AND. .NOT.lsame( vect, 'P' ) ) THEN
198 info = -1
199 ELSE IF( m.LT.0 ) THEN
200 info = -2
201 ELSE IF( n.LT.0 .OR. ( wantq .AND. ( n.GT.m .OR. n.LT.min( m,
202 $ k ) ) ) .OR. ( .NOT.wantq .AND. ( m.GT.n .OR. m.LT.
203 $ min( n, k ) ) ) ) THEN
204 info = -3
205 ELSE IF( k.LT.0 ) THEN
206 info = -4
207 ELSE IF( lda.LT.max( 1, m ) ) THEN
208 info = -6
209 ELSE IF( lwork.LT.max( 1, mn ) .AND. .NOT.lquery ) THEN
210 info = -9
211 END IF
212*
213 IF( info.EQ.0 ) THEN
214 work( 1 ) = 1
215 IF( wantq ) THEN
216 IF( m.GE.k ) THEN
217 CALL dorgqr( m, n, k, a, lda, tau, work, -1, iinfo )
218 ELSE
219 IF( m.GT.1 ) THEN
220 CALL dorgqr( m-1, m-1, m-1, a, lda, tau, work, -1,
221 $ iinfo )
222 END IF
223 END IF
224 ELSE
225 IF( k.LT.n ) THEN
226 CALL dorglq( m, n, k, a, lda, tau, work, -1, iinfo )
227 ELSE
228 IF( n.GT.1 ) THEN
229 CALL dorglq( n-1, n-1, n-1, a, lda, tau, work, -1,
230 $ iinfo )
231 END IF
232 END IF
233 END IF
234 lwkopt = int( work( 1 ) )
235 lwkopt = max(lwkopt, mn)
236 END IF
237*
238 IF( info.NE.0 ) THEN
239 CALL xerbla( 'DORGBR', -info )
240 RETURN
241 ELSE IF( lquery ) THEN
242 work( 1 ) = lwkopt
243 RETURN
244 END IF
245*
246* Quick return if possible
247*
248 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
249 work( 1 ) = 1
250 RETURN
251 END IF
252*
253 IF( wantq ) THEN
254*
255* Form Q, determined by a call to DGEBRD to reduce an m-by-k
256* matrix
257*
258 IF( m.GE.k ) THEN
259*
260* If m >= k, assume m >= n >= k
261*
262 CALL dorgqr( m, n, k, a, lda, tau, work, lwork, iinfo )
263*
264 ELSE
265*
266* If m < k, assume m = n
267*
268* Shift the vectors which define the elementary reflectors one
269* column to the right, and set the first row and column of Q
270* to those of the unit matrix
271*
272 DO 20 j = m, 2, -1
273 a( 1, j ) = zero
274 DO 10 i = j + 1, m
275 a( i, j ) = a( i, j-1 )
276 10 CONTINUE
277 20 CONTINUE
278 a( 1, 1 ) = one
279 DO 30 i = 2, m
280 a( i, 1 ) = zero
281 30 CONTINUE
282 IF( m.GT.1 ) THEN
283*
284* Form Q(2:m,2:m)
285*
286 CALL dorgqr( m-1, m-1, m-1, a( 2, 2 ), lda, tau, work,
287 $ lwork, iinfo )
288 END IF
289 END IF
290 ELSE
291*
292* Form P**T, determined by a call to DGEBRD to reduce a k-by-n
293* matrix
294*
295 IF( k.LT.n ) THEN
296*
297* If k < n, assume k <= m <= n
298*
299 CALL dorglq( m, n, k, a, lda, tau, work, lwork, iinfo )
300*
301 ELSE
302*
303* If k >= n, assume m = n
304*
305* Shift the vectors which define the elementary reflectors one
306* row downward, and set the first row and column of P**T to
307* those of the unit matrix
308*
309 a( 1, 1 ) = one
310 DO 40 i = 2, n
311 a( i, 1 ) = zero
312 40 CONTINUE
313 DO 60 j = 2, n
314 DO 50 i = j - 1, 2, -1
315 a( i, j ) = a( i-1, j )
316 50 CONTINUE
317 a( 1, j ) = zero
318 60 CONTINUE
319 IF( n.GT.1 ) THEN
320*
321* Form P**T(2:n,2:n)
322*
323 CALL dorglq( n-1, n-1, n-1, a( 2, 2 ), lda, tau, work,
324 $ lwork, iinfo )
325 END IF
326 END IF
327 END IF
328 work( 1 ) = lwkopt
329 RETURN
330*
331* End of DORGBR
332*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dorglq(m, n, k, a, lda, tau, work, lwork, info)
DORGLQ
Definition dorglq.f:125
subroutine dorgqr(m, n, k, a, lda, tau, work, lwork, info)
DORGQR
Definition dorgqr.f:126
Here is the call graph for this function:
Here is the caller graph for this function: