LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine srqt02 ( integer  M,
integer  N,
integer  K,
real, dimension( lda, * )  A,
real, dimension( lda, * )  AF,
real, dimension( lda, * )  Q,
real, dimension( lda, * )  R,
integer  LDA,
real, dimension( * )  TAU,
real, dimension( lwork )  WORK,
integer  LWORK,
real, dimension( * )  RWORK,
real, dimension( * )  RESULT 
)

SRQT02

Purpose:
 SRQT02 tests SORGRQ, which generates an m-by-n matrix Q with
 orthonornmal rows that is defined as the product of k elementary
 reflectors.

 Given the RQ factorization of an m-by-n matrix A, SRQT02 generates
 the orthogonal matrix Q defined by the factorization of the last k
 rows of A; it compares R(m-k+1:m,n-m+1:n) with
 A(m-k+1:m,1:n)*Q(n-m+1:n,1:n)', and checks that the rows of Q are
 orthonormal.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix Q to be generated.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix Q to be generated.
          N >= M >= 0.
[in]K
          K is INTEGER
          The number of elementary reflectors whose product defines the
          matrix Q. M >= K >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The m-by-n matrix A which was factorized by SRQT01.
[in]AF
          AF is REAL array, dimension (LDA,N)
          Details of the RQ factorization of A, as returned by SGERQF.
          See SGERQF for further details.
[out]Q
          Q is REAL array, dimension (LDA,N)
[out]R
          R is REAL array, dimension (LDA,M)
[in]LDA
          LDA is INTEGER
          The leading dimension of the arrays A, AF, Q and L. LDA >= N.
[in]TAU
          TAU is REAL array, dimension (M)
          The scalar factors of the elementary reflectors corresponding
          to the RQ factorization in AF.
[out]WORK
          WORK is REAL array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.
[out]RWORK
          RWORK is REAL array, dimension (M)
[out]RESULT
          RESULT is REAL array, dimension (2)
          The test ratios:
          RESULT(1) = norm( R - A*Q' ) / ( N * norm(A) * EPS )
          RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 138 of file srqt02.f.

138 *
139 * -- LAPACK test routine (version 3.4.0) --
140 * -- LAPACK is a software package provided by Univ. of Tennessee, --
141 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
142 * November 2011
143 *
144 * .. Scalar Arguments ..
145  INTEGER k, lda, lwork, m, n
146 * ..
147 * .. Array Arguments ..
148  REAL a( lda, * ), af( lda, * ), q( lda, * ),
149  $ r( lda, * ), result( * ), rwork( * ), tau( * ),
150  $ work( lwork )
151 * ..
152 *
153 * =====================================================================
154 *
155 * .. Parameters ..
156  REAL zero, one
157  parameter ( zero = 0.0e+0, one = 1.0e+0 )
158  REAL rogue
159  parameter ( rogue = -1.0e+10 )
160 * ..
161 * .. Local Scalars ..
162  INTEGER info
163  REAL anorm, eps, resid
164 * ..
165 * .. External Functions ..
166  REAL slamch, slange, slansy
167  EXTERNAL slamch, slange, slansy
168 * ..
169 * .. External Subroutines ..
170  EXTERNAL sgemm, slacpy, slaset, sorgrq, ssyrk
171 * ..
172 * .. Intrinsic Functions ..
173  INTRINSIC max, real
174 * ..
175 * .. Scalars in Common ..
176  CHARACTER*32 srnamt
177 * ..
178 * .. Common blocks ..
179  COMMON / srnamc / srnamt
180 * ..
181 * .. Executable Statements ..
182 *
183 * Quick return if possible
184 *
185  IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 ) THEN
186  result( 1 ) = zero
187  result( 2 ) = zero
188  RETURN
189  END IF
190 *
191  eps = slamch( 'Epsilon' )
192 *
193 * Copy the last k rows of the factorization to the array Q
194 *
195  CALL slaset( 'Full', m, n, rogue, rogue, q, lda )
196  IF( k.LT.n )
197  $ CALL slacpy( 'Full', k, n-k, af( m-k+1, 1 ), lda,
198  $ q( m-k+1, 1 ), lda )
199  IF( k.GT.1 )
200  $ CALL slacpy( 'Lower', k-1, k-1, af( m-k+2, n-k+1 ), lda,
201  $ q( m-k+2, n-k+1 ), lda )
202 *
203 * Generate the last n rows of the matrix Q
204 *
205  srnamt = 'SORGRQ'
206  CALL sorgrq( m, n, k, q, lda, tau( m-k+1 ), work, lwork, info )
207 *
208 * Copy R(m-k+1:m,n-m+1:n)
209 *
210  CALL slaset( 'Full', k, m, zero, zero, r( m-k+1, n-m+1 ), lda )
211  CALL slacpy( 'Upper', k, k, af( m-k+1, n-k+1 ), lda,
212  $ r( m-k+1, n-k+1 ), lda )
213 *
214 * Compute R(m-k+1:m,n-m+1:n) - A(m-k+1:m,1:n) * Q(n-m+1:n,1:n)'
215 *
216  CALL sgemm( 'No transpose', 'Transpose', k, m, n, -one,
217  $ a( m-k+1, 1 ), lda, q, lda, one, r( m-k+1, n-m+1 ),
218  $ lda )
219 *
220 * Compute norm( R - A*Q' ) / ( N * norm(A) * EPS ) .
221 *
222  anorm = slange( '1', k, n, a( m-k+1, 1 ), lda, rwork )
223  resid = slange( '1', k, m, r( m-k+1, n-m+1 ), lda, rwork )
224  IF( anorm.GT.zero ) THEN
225  result( 1 ) = ( ( resid / REAL( MAX( 1, N ) ) ) / anorm ) / eps
226  ELSE
227  result( 1 ) = zero
228  END IF
229 *
230 * Compute I - Q*Q'
231 *
232  CALL slaset( 'Full', m, m, zero, one, r, lda )
233  CALL ssyrk( 'Upper', 'No transpose', m, n, -one, q, lda, one, r,
234  $ lda )
235 *
236 * Compute norm( I - Q*Q' ) / ( N * EPS ) .
237 *
238  resid = slansy( '1', 'Upper', m, r, lda, rwork )
239 *
240  result( 2 ) = ( resid / REAL( MAX( 1, N ) ) ) / eps
241 *
242  RETURN
243 *
244 * End of SRQT02
245 *
subroutine ssyrk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
SSYRK
Definition: ssyrk.f:171
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:105
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: slaset.f:112
real function slange(NORM, M, N, A, LDA, WORK)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slange.f:116
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine sorgrq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGRQ
Definition: sorgrq.f:130
real function slansy(NORM, UPLO, N, A, LDA, WORK)
SLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix.
Definition: slansy.f:124

Here is the call graph for this function:

Here is the caller graph for this function: