 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ sqlt02()

 subroutine sqlt02 ( integer M, integer N, integer K, real, dimension( lda, * ) A, real, dimension( lda, * ) AF, real, dimension( lda, * ) Q, real, dimension( lda, * ) L, integer LDA, real, dimension( * ) TAU, real, dimension( lwork ) WORK, integer LWORK, real, dimension( * ) RWORK, real, dimension( * ) RESULT )

SQLT02

Purpose:
``` SQLT02 tests SORGQL, which generates an m-by-n matrix Q with
orthonornmal columns that is defined as the product of k elementary
reflectors.

Given the QL factorization of an m-by-n matrix A, SQLT02 generates
the orthogonal matrix Q defined by the factorization of the last k
columns of A; it compares L(m-n+1:m,n-k+1:n) with
Q(1:m,m-n+1:m)'*A(1:m,n-k+1:n), and checks that the columns 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. M >= N >= 0.``` [in] K ``` K is INTEGER The number of elementary reflectors whose product defines the matrix Q. N >= K >= 0.``` [in] A ``` A is REAL array, dimension (LDA,N) The m-by-n matrix A which was factorized by SQLT01.``` [in] AF ``` AF is REAL array, dimension (LDA,N) Details of the QL factorization of A, as returned by SGEQLF. See SGEQLF for further details.``` [out] Q ` Q is REAL array, dimension (LDA,N)` [out] L ` L is REAL array, dimension (LDA,N)` [in] LDA ``` LDA is INTEGER The leading dimension of the arrays A, AF, Q and L. LDA >= M.``` [in] TAU ``` TAU is REAL array, dimension (N) The scalar factors of the elementary reflectors corresponding to the QL 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( L - Q'*A ) / ( M * norm(A) * EPS ) RESULT(2) = norm( I - Q'*Q ) / ( M * EPS )```

Definition at line 134 of file sqlt02.f.

136*
137* -- LAPACK test routine --
138* -- LAPACK is a software package provided by Univ. of Tennessee, --
139* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
140*
141* .. Scalar Arguments ..
142 INTEGER K, LDA, LWORK, M, N
143* ..
144* .. Array Arguments ..
145 REAL A( LDA, * ), AF( LDA, * ), L( LDA, * ),
146 \$ Q( LDA, * ), RESULT( * ), RWORK( * ), TAU( * ),
147 \$ WORK( LWORK )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 REAL ZERO, ONE
154 parameter( zero = 0.0e+0, one = 1.0e+0 )
155 REAL ROGUE
156 parameter( rogue = -1.0e+10 )
157* ..
158* .. Local Scalars ..
159 INTEGER INFO
160 REAL ANORM, EPS, RESID
161* ..
162* .. External Functions ..
163 REAL SLAMCH, SLANGE, SLANSY
164 EXTERNAL slamch, slange, slansy
165* ..
166* .. External Subroutines ..
167 EXTERNAL sgemm, slacpy, slaset, sorgql, ssyrk
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC max, real
171* ..
172* .. Scalars in Common ..
173 CHARACTER*32 SRNAMT
174* ..
175* .. Common blocks ..
176 COMMON / srnamc / srnamt
177* ..
178* .. Executable Statements ..
179*
180* Quick return if possible
181*
182 IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 ) THEN
183 result( 1 ) = zero
184 result( 2 ) = zero
185 RETURN
186 END IF
187*
188 eps = slamch( 'Epsilon' )
189*
190* Copy the last k columns of the factorization to the array Q
191*
192 CALL slaset( 'Full', m, n, rogue, rogue, q, lda )
193 IF( k.LT.m )
194 \$ CALL slacpy( 'Full', m-k, k, af( 1, n-k+1 ), lda,
195 \$ q( 1, n-k+1 ), lda )
196 IF( k.GT.1 )
197 \$ CALL slacpy( 'Upper', k-1, k-1, af( m-k+1, n-k+2 ), lda,
198 \$ q( m-k+1, n-k+2 ), lda )
199*
200* Generate the last n columns of the matrix Q
201*
202 srnamt = 'SORGQL'
203 CALL sorgql( m, n, k, q, lda, tau( n-k+1 ), work, lwork, info )
204*
205* Copy L(m-n+1:m,n-k+1:n)
206*
207 CALL slaset( 'Full', n, k, zero, zero, l( m-n+1, n-k+1 ), lda )
208 CALL slacpy( 'Lower', k, k, af( m-k+1, n-k+1 ), lda,
209 \$ l( m-k+1, n-k+1 ), lda )
210*
211* Compute L(m-n+1:m,n-k+1:n) - Q(1:m,m-n+1:m)' * A(1:m,n-k+1:n)
212*
213 CALL sgemm( 'Transpose', 'No transpose', n, k, m, -one, q, lda,
214 \$ a( 1, n-k+1 ), lda, one, l( m-n+1, n-k+1 ), lda )
215*
216* Compute norm( L - Q'*A ) / ( M * norm(A) * EPS ) .
217*
218 anorm = slange( '1', m, k, a( 1, n-k+1 ), lda, rwork )
219 resid = slange( '1', n, k, l( m-n+1, n-k+1 ), lda, rwork )
220 IF( anorm.GT.zero ) THEN
221 result( 1 ) = ( ( resid / real( max( 1, m ) ) ) / anorm ) / eps
222 ELSE
223 result( 1 ) = zero
224 END IF
225*
226* Compute I - Q'*Q
227*
228 CALL slaset( 'Full', n, n, zero, one, l, lda )
229 CALL ssyrk( 'Upper', 'Transpose', n, m, -one, q, lda, one, l,
230 \$ lda )
231*
232* Compute norm( I - Q'*Q ) / ( M * EPS ) .
233*
234 resid = slansy( '1', 'Upper', n, l, lda, rwork )
235*
236 result( 2 ) = ( resid / real( max( 1, m ) ) ) / eps
237*
238 RETURN
239*
240* End of SQLT02
241*
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:110
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:103
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:114
subroutine sorgql(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGQL
Definition: sorgql.f:128
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,...
Definition: slansy.f:122
subroutine ssyrk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
SSYRK
Definition: ssyrk.f:169
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:187
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: