LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ dgelqf()

subroutine dgelqf ( integer  M,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  TAU,
double precision, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

DGELQF

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

Purpose:
 DGELQF computes an LQ factorization of a real M-by-N matrix A:

    A = ( L 0 ) *  Q

 where:

    Q is a N-by-N orthogonal matrix;
    L is an lower-triangular M-by-M matrix;
    0 is a M-by-(N-M) 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 DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the M-by-N matrix A.
          On exit, the elements on and below the diagonal of the array
          contain the m-by-min(m,n) lower trapezoidal matrix L (L is
          lower triangular if m <= n); the elements above the diagonal,
          with the array TAU, represent the orthogonal matrix Q as a
          product of 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 DOUBLE PRECISION array, dimension (min(M,N))
          The scalar factors of the elementary reflectors (see Further
          Details).
[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 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(k) . . . H(2) H(1), where k = min(m,n).

  Each H(i) has the form

     H(i) = I - tau * v * v**T

  where tau is a real scalar, and v is a real vector with
  v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n),
  and tau in TAU(i).

Definition at line 145 of file dgelqf.f.

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