LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ slqt04()

subroutine slqt04 ( integer  m,
integer  n,
integer  nb,
real, dimension(6)  result 
)

SLQT04

Purpose:
 SLQT04 tests SGELQT and SGEMLQT.
Parameters
[in]M
          M is INTEGER
          Number of rows in test matrix.
[in]N
          N is INTEGER
          Number of columns in test matrix.
[in]NB
          NB is INTEGER
          Block size of test matrix.  NB <= Min(M,N).
[out]RESULT
          RESULT is REAL array, dimension (6)
          Results of each of the six tests below.

          RESULT(1) = | A - L Q |
          RESULT(2) = | I - Q Q^H |
          RESULT(3) = | Q C - Q C |
          RESULT(4) = | Q^H C - Q^H C |
          RESULT(5) = | C Q - C Q |
          RESULT(6) = | C Q^H - C Q^H |
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 72 of file slqt04.f.

73 IMPLICIT NONE
74*
75* -- LAPACK test routine --
76* -- LAPACK is a software package provided by Univ. of Tennessee, --
77* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
78*
79* .. Scalar Arguments ..
80 INTEGER M, N, NB, LDT
81* .. Return values ..
82 REAL RESULT(6)
83*
84* =====================================================================
85*
86* ..
87* .. Local allocatable arrays
88 REAL, ALLOCATABLE :: AF(:,:), Q(:,:),
89 $ L(:,:), RWORK(:), WORK( : ), T(:,:),
90 $ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:)
91*
92* .. Parameters ..
93 REAL ONE, ZERO
94 parameter( zero = 0.0, one = 1.0 )
95* ..
96* .. Local Scalars ..
97 INTEGER INFO, J, K, LL, LWORK
98 REAL ANORM, EPS, RESID, CNORM, DNORM
99* ..
100* .. Local Arrays ..
101 INTEGER ISEED( 4 )
102* ..
103* .. External Functions ..
104 REAL SLAMCH, SLANGE, SLANSY
105 LOGICAL LSAME
106 EXTERNAL slamch, slange, slansy, lsame
107* ..
108* .. Intrinsic Functions ..
109 INTRINSIC max, min
110* ..
111* .. Data statements ..
112 DATA iseed / 1988, 1989, 1990, 1991 /
113*
114 eps = slamch( 'Epsilon' )
115 k = min(m,n)
116 ll = max(m,n)
117 lwork = max(2,ll)*max(2,ll)*nb
118*
119* Dynamically allocate local arrays
120*
121 ALLOCATE ( a(m,n), af(m,n), q(n,n), l(ll,n), rwork(ll),
122 $ work(lwork), t(nb,n), c(m,n), cf(m,n),
123 $ d(n,m), df(n,m) )
124*
125* Put random numbers into A and copy to AF
126*
127 ldt=nb
128 DO j=1,n
129 CALL slarnv( 2, iseed, m, a( 1, j ) )
130 END DO
131 CALL slacpy( 'Full', m, n, a, m, af, m )
132*
133* Factor the matrix A in the array AF.
134*
135 CALL sgelqt( m, n, nb, af, m, t, ldt, work, info )
136*
137* Generate the n-by-n matrix Q
138*
139 CALL slaset( 'Full', n, n, zero, one, q, n )
140 CALL sgemlqt( 'R', 'N', n, n, k, nb, af, m, t, ldt, q, n,
141 $ work, info )
142*
143* Copy R
144*
145 CALL slaset( 'Full', m, n, zero, zero, l, ll )
146 CALL slacpy( 'Lower', m, n, af, m, l, ll )
147*
148* Compute |L - A*Q'| / |A| and store in RESULT(1)
149*
150 CALL sgemm( 'N', 'T', m, n, n, -one, a, m, q, n, one, l, ll )
151 anorm = slange( '1', m, n, a, m, rwork )
152 resid = slange( '1', m, n, l, ll, rwork )
153 IF( anorm.GT.zero ) THEN
154 result( 1 ) = resid / (eps*max(1,m)*anorm)
155 ELSE
156 result( 1 ) = zero
157 END IF
158*
159* Compute |I - Q'*Q| and store in RESULT(2)
160*
161 CALL slaset( 'Full', n, n, zero, one, l, ll )
162 CALL ssyrk( 'U', 'C', n, n, -one, q, n, one, l, ll )
163 resid = slansy( '1', 'Upper', n, l, ll, rwork )
164 result( 2 ) = resid / (eps*max(1,n))
165*
166* Generate random m-by-n matrix C and a copy CF
167*
168 DO j=1,m
169 CALL slarnv( 2, iseed, n, d( 1, j ) )
170 END DO
171 dnorm = slange( '1', n, m, d, n, rwork)
172 CALL slacpy( 'Full', n, m, d, n, df, n )
173*
174* Apply Q to C as Q*C
175*
176 CALL sgemlqt( 'L', 'N', n, m, k, nb, af, m, t, nb, df, n,
177 $ work, info)
178*
179* Compute |Q*D - Q*D| / |D|
180*
181 CALL sgemm( 'N', 'N', n, m, n, -one, q, n, d, n, one, df, n )
182 resid = slange( '1', n, m, df, n, rwork )
183 IF( dnorm.GT.zero ) THEN
184 result( 3 ) = resid / (eps*max(1,m)*dnorm)
185 ELSE
186 result( 3 ) = zero
187 END IF
188*
189* Copy D into DF again
190*
191 CALL slacpy( 'Full', n, m, d, n, df, n )
192*
193* Apply Q to D as QT*D
194*
195 CALL sgemlqt( 'L', 'T', n, m, k, nb, af, m, t, nb, df, n,
196 $ work, info)
197*
198* Compute |QT*D - QT*D| / |D|
199*
200 CALL sgemm( 'T', 'N', n, m, n, -one, q, n, d, n, one, df, n )
201 resid = slange( '1', n, m, df, n, rwork )
202 IF( dnorm.GT.zero ) THEN
203 result( 4 ) = resid / (eps*max(1,m)*dnorm)
204 ELSE
205 result( 4 ) = zero
206 END IF
207*
208* Generate random n-by-m matrix D and a copy DF
209*
210 DO j=1,n
211 CALL slarnv( 2, iseed, m, c( 1, j ) )
212 END DO
213 cnorm = slange( '1', m, n, c, m, rwork)
214 CALL slacpy( 'Full', m, n, c, m, cf, m )
215*
216* Apply Q to C as C*Q
217*
218 CALL sgemlqt( 'R', 'N', m, n, k, nb, af, m, t, nb, cf, m,
219 $ work, info)
220*
221* Compute |C*Q - C*Q| / |C|
222*
223 CALL sgemm( 'N', 'N', m, n, n, -one, c, m, q, n, one, cf, m )
224 resid = slange( '1', n, m, df, n, rwork )
225 IF( cnorm.GT.zero ) THEN
226 result( 5 ) = resid / (eps*max(1,m)*dnorm)
227 ELSE
228 result( 5 ) = zero
229 END IF
230*
231* Copy C into CF again
232*
233 CALL slacpy( 'Full', m, n, c, m, cf, m )
234*
235* Apply Q to D as D*QT
236*
237 CALL sgemlqt( 'R', 'T', m, n, k, nb, af, m, t, nb, cf, m,
238 $ work, info)
239*
240* Compute |C*QT - C*QT| / |C|
241*
242 CALL sgemm( 'N', 'T', m, n, n, -one, c, m, q, n, one, cf, m )
243 resid = slange( '1', m, n, cf, m, rwork )
244 IF( cnorm.GT.zero ) THEN
245 result( 6 ) = resid / (eps*max(1,m)*dnorm)
246 ELSE
247 result( 6 ) = zero
248 END IF
249*
250* Deallocate all arrays
251*
252 DEALLOCATE ( a, af, q, l, rwork, work, t, c, d, cf, df)
253*
254 RETURN
subroutine sgelqt(m, n, mb, a, lda, t, ldt, work, info)
SGELQT
Definition sgelqt.f:124
subroutine sgemlqt(side, trans, m, n, k, mb, v, ldv, t, ldt, c, ldc, work, info)
SGEMLQT
Definition sgemlqt.f:153
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
Definition sgemm.f:188
subroutine ssyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
SSYRK
Definition ssyrk.f:169
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 slamch(cmach)
SLAMCH
Definition slamch.f:68
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
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 slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition slarnv.f:97
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
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: