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

◆ zgerqf()

subroutine zgerqf ( integer m,
integer n,
complex*16, dimension( lda, * ) a,
integer lda,
complex*16, dimension( * ) tau,
complex*16, dimension( * ) work,
integer lwork,
integer info )

ZGERQF

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

Purpose:
!>
!> ZGERQF computes an RQ factorization of a complex M-by-N matrix A:
!> A = R * Q.
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the M-by-N matrix A.
!>          On exit,
!>          if m <= n, the upper triangle of the subarray
!>          A(1:m,n-m+1:n) contains the M-by-M upper triangular matrix R;
!>          if m >= n, the elements on and above the (m-n)-th subdiagonal
!>          contain the M-by-N upper trapezoidal matrix R;
!>          the remaining elements, with the array TAU, represent the
!>          unitary matrix Q as a product of min(m,n) elementary
!>          reflectors (see Further Details).
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!> 
[out]TAU
!>          TAU is COMPLEX*16 array, dimension (min(M,N))
!>          The scalar factors of the elementary reflectors (see Further
!>          Details).
!> 
[out]WORK
!>          WORK is COMPLEX*16 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 >= 1, if MIN(M,N) = 0, and LWORK >= M, otherwise.
!>          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 had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  The matrix Q is represented as a product of elementary reflectors
!>
!>     Q = H(1)**H H(2)**H . . . H(k)**H, where k = min(m,n).
!>
!>  Each H(i) has the form
!>
!>     H(i) = I - tau * v * v**H
!>
!>  where tau is a complex scalar, and v is a complex vector with
!>  v(n-k+i+1:n) = 0 and v(n-k+i) = 1; conjg(v(1:n-k+i-1)) is stored on
!>  exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i).
!> 

Definition at line 136 of file zgerqf.f.

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