LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ sgeqrt3()

recursive subroutine sgeqrt3 ( integer  M,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldt, * )  T,
integer  LDT,
integer  INFO 
)

SGEQRT3 recursively computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.

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

Purpose:
 SGEQRT3 recursively computes a QR factorization of a real M-by-N
 matrix A, using the compact WY representation of Q.

 Based on the algorithm of Elmroth and Gustavson,
 IBM J. Res. Develop. Vol 44 No. 4 July 2000.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= N.
[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 real M-by-N matrix A.  On exit, the elements on and
          above the diagonal contain the N-by-N upper triangular matrix R; the
          elements below the diagonal are the columns of V.  See below for
          further details.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,M).
[out]T
          T is REAL array, dimension (LDT,N)
          The N-by-N upper triangular factor of the block reflector.
          The elements on and above the diagonal contain the block
          reflector T; the elements below the diagonal are not used.
          See below for further details.
[in]LDT
          LDT is INTEGER
          The leading dimension of the array T.  LDT >= max(1,N).
[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 V stores the elementary reflectors H(i) in the i-th column
  below the diagonal. For example, if M=5 and N=3, the matrix V is

               V = (  1       )
                   ( v1  1    )
                   ( v1 v2  1 )
                   ( v1 v2 v3 )
                   ( v1 v2 v3 )

  where the vi's represent the vectors which define H(i), which are returned
  in the matrix A.  The 1's along the diagonal of V are not stored in A.  The
  block reflector H is then given by

               H = I - V * T * V**T

  where V**T is the transpose of V.

  For details of the algorithm, see Elmroth and Gustavson (cited above).

Definition at line 131 of file sgeqrt3.f.

132 *
133 * -- LAPACK computational routine --
134 * -- LAPACK is a software package provided by Univ. of Tennessee, --
135 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
136 *
137 * .. Scalar Arguments ..
138  INTEGER INFO, LDA, M, N, LDT
139 * ..
140 * .. Array Arguments ..
141  REAL A( LDA, * ), T( LDT, * )
142 * ..
143 *
144 * =====================================================================
145 *
146 * .. Parameters ..
147  REAL ONE
148  parameter( one = 1.0 )
149 * ..
150 * .. Local Scalars ..
151  INTEGER I, I1, J, J1, N1, N2, IINFO
152 * ..
153 * .. External Subroutines ..
154  EXTERNAL slarfg, strmm, sgemm, xerbla
155 * ..
156 * .. Executable Statements ..
157 *
158  info = 0
159  IF( n .LT. 0 ) THEN
160  info = -2
161  ELSE IF( m .LT. n ) THEN
162  info = -1
163  ELSE IF( lda .LT. max( 1, m ) ) THEN
164  info = -4
165  ELSE IF( ldt .LT. max( 1, n ) ) THEN
166  info = -6
167  END IF
168  IF( info.NE.0 ) THEN
169  CALL xerbla( 'SGEQRT3', -info )
170  RETURN
171  END IF
172 *
173  IF( n.EQ.1 ) THEN
174 *
175 * Compute Householder transform when N=1
176 *
177  CALL slarfg( m, a(1,1), a( min( 2, m ), 1 ), 1, t(1,1) )
178 *
179  ELSE
180 *
181 * Otherwise, split A into blocks...
182 *
183  n1 = n/2
184  n2 = n-n1
185  j1 = min( n1+1, n )
186  i1 = min( n+1, m )
187 *
188 * Compute A(1:M,1:N1) <- (Y1,R1,T1), where Q1 = I - Y1 T1 Y1^H
189 *
190  CALL sgeqrt3( m, n1, a, lda, t, ldt, iinfo )
191 *
192 * Compute A(1:M,J1:N) = Q1^H A(1:M,J1:N) [workspace: T(1:N1,J1:N)]
193 *
194  DO j=1,n2
195  DO i=1,n1
196  t( i, j+n1 ) = a( i, j+n1 )
197  END DO
198  END DO
199  CALL strmm( 'L', 'L', 'T', 'U', n1, n2, one,
200  & a, lda, t( 1, j1 ), ldt )
201 *
202  CALL sgemm( 'T', 'N', n1, n2, m-n1, one, a( j1, 1 ), lda,
203  & a( j1, j1 ), lda, one, t( 1, j1 ), ldt)
204 *
205  CALL strmm( 'L', 'U', 'T', 'N', n1, n2, one,
206  & t, ldt, t( 1, j1 ), ldt )
207 *
208  CALL sgemm( 'N', 'N', m-n1, n2, n1, -one, a( j1, 1 ), lda,
209  & t( 1, j1 ), ldt, one, a( j1, j1 ), lda )
210 *
211  CALL strmm( 'L', 'L', 'N', 'U', n1, n2, one,
212  & a, lda, t( 1, j1 ), ldt )
213 *
214  DO j=1,n2
215  DO i=1,n1
216  a( i, j+n1 ) = a( i, j+n1 ) - t( i, j+n1 )
217  END DO
218  END DO
219 *
220 * Compute A(J1:M,J1:N) <- (Y2,R2,T2) where Q2 = I - Y2 T2 Y2^H
221 *
222  CALL sgeqrt3( m-n1, n2, a( j1, j1 ), lda,
223  & t( j1, j1 ), ldt, iinfo )
224 *
225 * Compute T3 = T(1:N1,J1:N) = -T1 Y1^H Y2 T2
226 *
227  DO i=1,n1
228  DO j=1,n2
229  t( i, j+n1 ) = (a( j+n1, i ))
230  END DO
231  END DO
232 *
233  CALL strmm( 'R', 'L', 'N', 'U', n1, n2, one,
234  & a( j1, j1 ), lda, t( 1, j1 ), ldt )
235 *
236  CALL sgemm( 'T', 'N', n1, n2, m-n, one, a( i1, 1 ), lda,
237  & a( i1, j1 ), lda, one, t( 1, j1 ), ldt )
238 *
239  CALL strmm( 'L', 'U', 'N', 'N', n1, n2, -one, t, ldt,
240  & t( 1, j1 ), ldt )
241 *
242  CALL strmm( 'R', 'U', 'N', 'N', n1, n2, one,
243  & t( j1, j1 ), ldt, t( 1, j1 ), ldt )
244 *
245 * Y = (Y1,Y2); R = [ R1 A(1:N1,J1:N) ]; T = [T1 T3]
246 * [ 0 R2 ] [ 0 T2]
247 *
248  END IF
249 *
250  RETURN
251 *
252 * End of SGEQRT3
253 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
recursive subroutine sgeqrt3(M, N, A, LDA, T, LDT, INFO)
SGEQRT3 recursively computes a QR factorization of a general real or complex matrix using the compact...
Definition: sgeqrt3.f:132
subroutine slarfg(N, ALPHA, X, INCX, TAU)
SLARFG generates an elementary reflector (Householder matrix).
Definition: slarfg.f:106
subroutine strmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRMM
Definition: strmm.f:177
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:187
Here is the call graph for this function:
Here is the caller graph for this function: