LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
ddrvrf3.f
Go to the documentation of this file.
1*> \brief \b DDRVRF3
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE DDRVRF3( NOUT, NN, NVAL, THRESH, A, LDA, ARF, B1, B2,
12* + D_WORK_DLANGE, D_WORK_DGEQRF, TAU )
13*
14* .. Scalar Arguments ..
15* INTEGER LDA, NN, NOUT
16* DOUBLE PRECISION THRESH
17* ..
18* .. Array Arguments ..
19* INTEGER NVAL( NN )
20* DOUBLE PRECISION A( LDA, * ), ARF( * ), B1( LDA, * ),
21* + B2( LDA, * ), D_WORK_DGEQRF( * ),
22* + D_WORK_DLANGE( * ), TAU( * )
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> DDRVRF3 tests the LAPACK RFP routines:
32*> DTFSM
33*> \endverbatim
34*
35* Arguments:
36* ==========
37*
38*> \param[in] NOUT
39*> \verbatim
40*> NOUT is INTEGER
41*> The unit number for output.
42*> \endverbatim
43*>
44*> \param[in] NN
45*> \verbatim
46*> NN is INTEGER
47*> The number of values of N contained in the vector NVAL.
48*> \endverbatim
49*>
50*> \param[in] NVAL
51*> \verbatim
52*> NVAL is INTEGER array, dimension (NN)
53*> The values of the matrix dimension N.
54*> \endverbatim
55*>
56*> \param[in] THRESH
57*> \verbatim
58*> THRESH is DOUBLE PRECISION
59*> The threshold value for the test ratios. A result is
60*> included in the output file if RESULT >= THRESH. To have
61*> every test ratio printed, use THRESH = 0.
62*> \endverbatim
63*>
64*> \param[out] A
65*> \verbatim
66*> A is DOUBLE PRECISION array, dimension (LDA,NMAX)
67*> \endverbatim
68*>
69*> \param[in] LDA
70*> \verbatim
71*> LDA is INTEGER
72*> The leading dimension of the array A. LDA >= max(1,NMAX).
73*> \endverbatim
74*>
75*> \param[out] ARF
76*> \verbatim
77*> ARF is DOUBLE PRECISION array, dimension ((NMAX*(NMAX+1))/2).
78*> \endverbatim
79*>
80*> \param[out] B1
81*> \verbatim
82*> B1 is DOUBLE PRECISION array, dimension (LDA,NMAX)
83*> \endverbatim
84*>
85*> \param[out] B2
86*> \verbatim
87*> B2 is DOUBLE PRECISION array, dimension (LDA,NMAX)
88*> \endverbatim
89*>
90*> \param[out] D_WORK_DLANGE
91*> \verbatim
92*> D_WORK_DLANGE is DOUBLE PRECISION array, dimension (NMAX)
93*> \endverbatim
94*>
95*> \param[out] D_WORK_DGEQRF
96*> \verbatim
97*> D_WORK_DGEQRF is DOUBLE PRECISION array, dimension (NMAX)
98*> \endverbatim
99*>
100*> \param[out] TAU
101*> \verbatim
102*> TAU is DOUBLE PRECISION array, dimension (NMAX)
103*> \endverbatim
104*
105* Authors:
106* ========
107*
108*> \author Univ. of Tennessee
109*> \author Univ. of California Berkeley
110*> \author Univ. of Colorado Denver
111*> \author NAG Ltd.
112*
113*> \ingroup double_lin
114*
115* =====================================================================
116 SUBROUTINE ddrvrf3( NOUT, NN, NVAL, THRESH, A, LDA, ARF, B1, B2,
117 + D_WORK_DLANGE, D_WORK_DGEQRF, TAU )
118*
119* -- LAPACK test routine --
120* -- LAPACK is a software package provided by Univ. of Tennessee, --
121* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
122*
123* .. Scalar Arguments ..
124 INTEGER LDA, NN, NOUT
125 DOUBLE PRECISION THRESH
126* ..
127* .. Array Arguments ..
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* .. Parameters ..
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* .. Local Scalars ..
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* .. Local Arrays ..
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* .. External Functions ..
156 LOGICAL LSAME
157 DOUBLE PRECISION DLAMCH, DLANGE, DLARND
158 EXTERNAL dlamch, dlange, dlarnd, lsame
159* ..
160* .. External Subroutines ..
161 EXTERNAL dtrttf, dgeqrf, dgeqlf, dtfsm, dtrsm
162* ..
163* .. Intrinsic Functions ..
164 INTRINSIC max, sqrt
165* ..
166* .. Scalars in Common ..
167 CHARACTER*32 SRNAMT
168* ..
169* .. Common blocks ..
170 COMMON / srnamc / srnamt
171* ..
172* .. Data statements ..
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* .. Executable Statements ..
181*
182* Initialize constants and the random number seed.
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* All the parameters are set:
231* CFORM, SIDE, UPLO, TRANS, DIAG, M, N,
232* and ALPHA
233* READY TO TEST!
234*
235 nrun = nrun + 1
236*
237 IF ( iside.EQ.1 ) THEN
238*
239* The case ISIDE.EQ.1 is when SIDE.EQ.'L'
240* -> A is M-by-M ( B is M-by-N )
241*
242 na = m
243*
244 ELSE
245*
246* The case ISIDE.EQ.2 is when SIDE.EQ.'R'
247* -> A is N-by-N ( B is M-by-N )
248*
249 na = n
250*
251 END IF
252*
253* Generate A our NA--by--NA triangular
254* matrix.
255* Our test is based on forward error so we
256* do want A to be well conditioned! To get
257* a well-conditioned triangular matrix, we
258* take the R factor of the QR/LQ factorization
259* of a random matrix.
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* The case IUPLO.EQ.1 is when SIDE.EQ.'U'
270* -> QR factorization.
271*
272 srnamt = 'DGEQRF'
273 CALL dgeqrf( na, na, a, lda, tau,
274 + d_work_dgeqrf, lda,
275 + info )
276*
277* Forcing main diagonal of test matrix to
278* be unit makes it ill-conditioned for
279* some test cases
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* The case IUPLO.EQ.2 is when SIDE.EQ.'L'
293* -> QL factorization.
294*
295 srnamt = 'DGELQF'
296 CALL dgelqf( na, na, a, lda, tau,
297 + d_work_dgeqrf, lda,
298 + info )
299*
300* Forcing main diagonal of test matrix to
301* be unit makes it ill-conditioned for
302* some test cases
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* Store a copy of A in RFP format (in ARF).
316*
317 srnamt = 'DTRTTF'
318 CALL dtrttf( cform, uplo, na, a, lda, arf,
319 + info )
320*
321* Generate B1 our M--by--N right-hand side
322* and store a copy in B2.
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* Solve op( A ) X = B or X op( A ) = B
332* with DTRSM
333*
334 srnamt = 'DTRSM'
335 CALL dtrsm( side, uplo, trans, diag, m, n,
336 + alpha, a, lda, b1, lda )
337*
338* Solve op( A ) X = B or X op( A ) = B
339* with DTFSM
340*
341 srnamt = 'DTFSM'
342 CALL dtfsm( cform, side, uplo, trans,
343 + diag, m, n, alpha, arf, b2,
344 + lda )
345*
346* Check that the result agrees.
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* Print a summary of the results.
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* End of DDRVRF3
401*
402 END
subroutine ddrvrf3(nout, nn, nval, thresh, a, lda, arf, b1, b2, d_work_dlange, d_work_dgeqrf, tau)
DDRVRF3
Definition ddrvrf3.f:118
subroutine dgelqf(m, n, a, lda, tau, work, lwork, info)
DGELQF
Definition dgelqf.f:143
subroutine dgeqlf(m, n, a, lda, tau, work, lwork, info)
DGEQLF
Definition dgeqlf.f:138
subroutine dgeqrf(m, n, a, lda, tau, work, lwork, info)
DGEQRF
Definition dgeqrf.f:146
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).
Definition dtfsm.f:277
subroutine dtrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
DTRSM
Definition dtrsm.f:181
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...
Definition dtrttf.f:194