LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine sgeqlf ( integer  M,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  TAU,
real, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

SGEQLF

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

Purpose:
 SGEQLF computes a QL factorization of a real M-by-N matrix A:
 A = Q * L.
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 REAL array, dimension (LDA,N)
          On entry, the M-by-N matrix A.
          On exit,
          if m >= n, the lower triangle of the subarray
          A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L;
          if m <= n, the elements on and below the (n-m)-th
          superdiagonal contain the M-by-N lower trapezoidal matrix L;
          the remaining elements, 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 REAL array, dimension (min(M,N))
          The scalar factors of the elementary reflectors (see Further
          Details).
[out]WORK
          WORK is REAL 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 2011
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(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in
  A(1:m-k+i-1,n-k+i), and tau in TAU(i).

Definition at line 140 of file sgeqlf.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: