118
119
120
121
122
123
124 INTEGER LDA, NN, NOUT
125 DOUBLE PRECISION THRESH
126
127
128 INTEGER NVAL( NN )
129 DOUBLE PRECISION A( LDA, * ), ARF( * ), B1( LDA, * ),
130 + B2( LDA, * ), D_WORK_DGEQRF( * ),
131 + D_WORK_DLANGE( * ), TAU( * )
132
133
134
135
136
137 DOUBLE PRECISION ZERO, ONE
138 parameter( zero = ( 0.0d+0, 0.0d+0 ) ,
139 + one = ( 1.0d+0, 0.0d+0 ) )
140 INTEGER NTESTS
141 parameter( ntests = 1 )
142
143
144 CHARACTER UPLO, CFORM, DIAG, TRANS, SIDE
145 INTEGER I, IFORM, IIM, IIN, INFO, IUPLO, J, M, N, NA,
146 + NFAIL, NRUN, ISIDE, IDIAG, IALPHA, ITRANS
147 DOUBLE PRECISION EPS, ALPHA
148
149
150 CHARACTER UPLOS( 2 ), FORMS( 2 ), TRANSS( 2 ),
151 + DIAGS( 2 ), SIDES( 2 )
152 INTEGER ISEED( 4 ), ISEEDY( 4 )
153 DOUBLE PRECISION RESULT( NTESTS )
154
155
156 LOGICAL LSAME
157 DOUBLE PRECISION DLAMCH, DLANGE, DLARND
159
160
162
163
164 INTRINSIC max, sqrt
165
166
167 CHARACTER*32 SRNAMT
168
169
170 COMMON / srnamc / srnamt
171
172
173 DATA iseedy / 1988, 1989, 1990, 1991 /
174 DATA uplos / 'U', 'L' /
175 DATA forms / 'N', 'T' /
176 DATA sides / 'L', 'R' /
177 DATA transs / 'N', 'T' /
178 DATA diags / 'N', 'U' /
179
180
181
182
183
184 nrun = 0
185 nfail = 0
186 info = 0
187 DO 10 i = 1, 4
188 iseed( i ) = iseedy( i )
189 10 CONTINUE
190 eps =
dlamch(
'Precision' )
191
192 DO 170 iim = 1, nn
193
194 m = nval( iim )
195
196 DO 160 iin = 1, nn
197
198 n = nval( iin )
199
200 DO 150 iform = 1, 2
201
202 cform = forms( iform )
203
204 DO 140 iuplo = 1, 2
205
206 uplo = uplos( iuplo )
207
208 DO 130 iside = 1, 2
209
210 side = sides( iside )
211
212 DO 120 itrans = 1, 2
213
214 trans = transs( itrans )
215
216 DO 110 idiag = 1, 2
217
218 diag = diags( idiag )
219
220 DO 100 ialpha = 1, 3
221
222 IF ( ialpha.EQ.1 ) THEN
223 alpha = zero
224 ELSE IF ( ialpha.EQ.2 ) THEN
225 alpha = one
226 ELSE
227 alpha =
dlarnd( 2, iseed )
228 END IF
229
230
231
232
233
234
235 nrun = nrun + 1
236
237 IF ( iside.EQ.1 ) THEN
238
239
240
241
242 na = m
243
244 ELSE
245
246
247
248
249 na = n
250
251 END IF
252
253
254
255
256
257
258
259
260
261 DO j = 1, na
262 DO i = 1, na
263 a( i, j ) =
dlarnd( 2, iseed )
264 END DO
265 END DO
266
267 IF ( iuplo.EQ.1 ) THEN
268
269
270
271
272 srnamt = 'DGEQRF'
273 CALL dgeqrf( na, na, a, lda, tau,
274 + d_work_dgeqrf, lda,
275 + info )
276
277
278
279
280
281 IF (
lsame( diag,
'U' ) )
THEN
282 DO j = 1, na
283 DO i = 1, j
284 a( i, j ) = a( i, j ) /
285 + ( 2.0 * a( j, j ) )
286 END DO
287 END DO
288 END IF
289
290 ELSE
291
292
293
294
295 srnamt = 'DGELQF'
296 CALL dgelqf( na, na, a, lda, tau,
297 + d_work_dgeqrf, lda,
298 + info )
299
300
301
302
303
304 IF (
lsame( diag,
'U' ) )
THEN
305 DO i = 1, na
306 DO j = 1, i
307 a( i, j ) = a( i, j ) /
308 + ( 2.0 * a( i, i ) )
309 END DO
310 END DO
311 END IF
312
313 END IF
314
315
316
317 srnamt = 'DTRTTF'
318 CALL dtrttf( cform, uplo, na, a, lda, arf,
319 + info )
320
321
322
323
324 DO j = 1, n
325 DO i = 1, m
326 b1( i, j ) =
dlarnd( 2, iseed )
327 b2( i, j ) = b1( i, j )
328 END DO
329 END DO
330
331
332
333
334 srnamt = 'DTRSM'
335 CALL dtrsm( side, uplo, trans, diag, m, n,
336 + alpha, a, lda, b1, lda )
337
338
339
340
341 srnamt = 'DTFSM'
342 CALL dtfsm( cform, side, uplo, trans,
343 + diag, m, n, alpha, arf, b2,
344 + lda )
345
346
347
348 DO j = 1, n
349 DO i = 1, m
350 b1( i, j ) = b2( i, j ) - b1( i, j )
351 END DO
352 END DO
353
354 result( 1 ) =
dlange(
'I', m, n, b1, lda,
355 + d_work_dlange )
356
357 result( 1 ) = result( 1 ) / sqrt( eps )
358 + / max( max( m, n ), 1 )
359
360 IF( result( 1 ).GE.thresh ) THEN
361 IF( nfail.EQ.0 ) THEN
362 WRITE( nout, * )
363 WRITE( nout, fmt = 9999 )
364 END IF
365 WRITE( nout, fmt = 9997 ) 'DTFSM',
366 + cform, side, uplo, trans, diag, m,
367 + n, result( 1 )
368 nfail = nfail + 1
369 END IF
370
371 100 CONTINUE
372 110 CONTINUE
373 120 CONTINUE
374 130 CONTINUE
375 140 CONTINUE
376 150 CONTINUE
377 160 CONTINUE
378 170 CONTINUE
379
380
381
382 IF ( nfail.EQ.0 ) THEN
383 WRITE( nout, fmt = 9996 ) 'DTFSM', nrun
384 ELSE
385 WRITE( nout, fmt = 9995 ) 'DTFSM', nfail, nrun
386 END IF
387
388 9999 FORMAT( 1x, ' *** Error(s) or Failure(s) while testing DTFSM
389 + ***')
390 9997 FORMAT( 1x, ' Failure in ',a5,', CFORM=''',a1,''',',
391 + ' SIDE=''',a1,''',',' UPLO=''',a1,''',',' TRANS=''',a1,''',',
392 + ' DIAG=''',a1,''',',' M=',i3,', N =', i3,', test=',g12.5)
393 9996 FORMAT( 1x, 'All tests for ',a5,' auxiliary routine passed the ',
394 + 'threshold ( ',i5,' tests run)')
395 9995 FORMAT( 1x, a6, ' auxiliary routine: ',i5,' out of ',i5,
396 + ' tests failed to pass the threshold')
397
398 RETURN
399
400
401
double precision function dlarnd(idist, iseed)
DLARND
subroutine dgelqf(m, n, a, lda, tau, work, lwork, info)
DGELQF
subroutine dgeqlf(m, n, a, lda, tau, work, lwork, info)
DGEQLF
subroutine dgeqrf(m, n, a, lda, tau, work, lwork, info)
DGEQRF
double precision function dlamch(cmach)
DLAMCH
double precision function dlange(norm, m, n, a, lda, work)
DLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
logical function lsame(ca, cb)
LSAME
subroutine dtfsm(transr, side, uplo, trans, diag, m, n, alpha, a, b, ldb)
DTFSM solves a matrix equation (one operand is a triangular matrix in RFP format).
subroutine dtrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
DTRSM
subroutine dtrttf(transr, uplo, n, a, lda, arf, info)
DTRTTF copies a triangular matrix from the standard full format (TR) to the rectangular full packed f...