LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ cgeqrfp()

subroutine cgeqrfp ( integer  M,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( * )  TAU,
complex, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

CGEQRFP

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

Purpose:
 CGEQR2P computes a QR factorization of a complex M-by-N matrix A:

    A = Q * ( R ),
            ( 0 )

 where:

    Q is a M-by-M orthogonal matrix;
    R is an upper-triangular N-by-N matrix with nonnegative diagonal
    entries;
    0 is a (M-N)-by-N zero matrix, if M > N.
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 array, dimension (LDA,N)
          On entry, the M-by-N matrix A.
          On exit, the elements on and above the diagonal of the array
          contain the min(M,N)-by-N upper trapezoidal matrix R (R is
          upper triangular if m >= n). The diagonal entries of R
          are real and nonnegative; the elements below the diagonal,
          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 array, dimension (min(M,N))
          The scalar factors of the elementary reflectors (see Further
          Details).
[out]WORK
          WORK is COMPLEX 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,N).
          For optimum performance LWORK >= 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.
Date
November 2019
Further Details:
  The matrix Q is represented as a product of elementary reflectors

     Q = H(1) H(2) . . . H(k), 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(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
  and tau in TAU(i).

 See Lapack Working Note 203 for details

Definition at line 151 of file cgeqrfp.f.

151 *
152 * -- LAPACK computational routine (version 3.9.0) --
153 * -- LAPACK is a software package provided by Univ. of Tennessee, --
154 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
155 * November 2019
156 *
157 * .. Scalar Arguments ..
158  INTEGER INFO, LDA, LWORK, M, N
159 * ..
160 * .. Array Arguments ..
161  COMPLEX A( LDA, * ), TAU( * ), WORK( * )
162 * ..
163 *
164 * =====================================================================
165 *
166 * .. Local Scalars ..
167  LOGICAL LQUERY
168  INTEGER I, IB, IINFO, IWS, K, LDWORK, LWKOPT, NB,
169  $ NBMIN, NX
170 * ..
171 * .. External Subroutines ..
172  EXTERNAL cgeqr2p, clarfb, clarft, xerbla
173 * ..
174 * .. Intrinsic Functions ..
175  INTRINSIC max, min
176 * ..
177 * .. External Functions ..
178  INTEGER ILAENV
179  EXTERNAL ilaenv
180 * ..
181 * .. Executable Statements ..
182 *
183 * Test the input arguments
184 *
185  info = 0
186  nb = ilaenv( 1, 'CGEQRF', ' ', m, n, -1, -1 )
187  lwkopt = n*nb
188  work( 1 ) = lwkopt
189  lquery = ( lwork.EQ.-1 )
190  IF( m.LT.0 ) THEN
191  info = -1
192  ELSE IF( n.LT.0 ) THEN
193  info = -2
194  ELSE IF( lda.LT.max( 1, m ) ) THEN
195  info = -4
196  ELSE IF( lwork.LT.max( 1, n ) .AND. .NOT.lquery ) THEN
197  info = -7
198  END IF
199  IF( info.NE.0 ) THEN
200  CALL xerbla( 'CGEQRFP', -info )
201  RETURN
202  ELSE IF( lquery ) THEN
203  RETURN
204  END IF
205 *
206 * Quick return if possible
207 *
208  k = min( m, n )
209  IF( k.EQ.0 ) THEN
210  work( 1 ) = 1
211  RETURN
212  END IF
213 *
214  nbmin = 2
215  nx = 0
216  iws = n
217  IF( nb.GT.1 .AND. nb.LT.k ) THEN
218 *
219 * Determine when to cross over from blocked to unblocked code.
220 *
221  nx = max( 0, ilaenv( 3, 'CGEQRF', ' ', m, n, -1, -1 ) )
222  IF( nx.LT.k ) THEN
223 *
224 * Determine if workspace is large enough for blocked code.
225 *
226  ldwork = n
227  iws = ldwork*nb
228  IF( lwork.LT.iws ) THEN
229 *
230 * Not enough workspace to use optimal NB: reduce NB and
231 * determine the minimum value of NB.
232 *
233  nb = lwork / ldwork
234  nbmin = max( 2, ilaenv( 2, 'CGEQRF', ' ', m, n, -1,
235  $ -1 ) )
236  END IF
237  END IF
238  END IF
239 *
240  IF( nb.GE.nbmin .AND. nb.LT.k .AND. nx.LT.k ) THEN
241 *
242 * Use blocked code initially
243 *
244  DO 10 i = 1, k - nx, nb
245  ib = min( k-i+1, nb )
246 *
247 * Compute the QR factorization of the current block
248 * A(i:m,i:i+ib-1)
249 *
250  CALL cgeqr2p( m-i+1, ib, a( i, i ), lda, tau( i ), work,
251  $ iinfo )
252  IF( i+ib.LE.n ) THEN
253 *
254 * Form the triangular factor of the block reflector
255 * H = H(i) H(i+1) . . . H(i+ib-1)
256 *
257  CALL clarft( 'Forward', 'Columnwise', m-i+1, ib,
258  $ a( i, i ), lda, tau( i ), work, ldwork )
259 *
260 * Apply H**H to A(i:m,i+ib:n) from the left
261 *
262  CALL clarfb( 'Left', 'Conjugate transpose', 'Forward',
263  $ 'Columnwise', m-i+1, n-i-ib+1, ib,
264  $ a( i, i ), lda, work, ldwork, a( i, i+ib ),
265  $ lda, work( ib+1 ), ldwork )
266  END IF
267  10 CONTINUE
268  ELSE
269  i = 1
270  END IF
271 *
272 * Use unblocked code to factor the last or only block.
273 *
274  IF( i.LE.k )
275  $ CALL cgeqr2p( m-i+1, n-i+1, a( i, i ), lda, tau( i ), work,
276  $ iinfo )
277 *
278  work( 1 ) = iws
279  RETURN
280 *
281 * End of CGEQRFP
282 *
Here is the call graph for this function:
Here is the caller graph for this function:
cgeqr2p
subroutine cgeqr2p(M, N, A, LDA, TAU, WORK, INFO)
CGEQR2P computes the QR factorization of a general rectangular matrix with non-negative diagonal elem...
Definition: cgeqr2p.f:136
xerbla
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
clarft
subroutine clarft(DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT)
CLARFT forms the triangular factor T of a block reflector H = I - vtvH
Definition: clarft.f:165
clarfb
subroutine clarfb(SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, T, LDT, C, LDC, WORK, LDWORK)
CLARFB applies a block reflector or its conjugate-transpose to a general rectangular matrix.
Definition: clarfb.f:199
ilaenv
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
ILAENV
Definition: tstiee.f:83