LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zdrvsy_rk.f
Go to the documentation of this file.
1*> \brief \b ZDRVSY_RK
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 ZDRVSY_RK( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR,
12* NMAX, A, AFAC, E, AINV, B, X, XACT, WORK,
13* RWORK, IWORK, NOUT )
14*
15* .. Scalar Arguments ..
16* LOGICAL TSTERR
17* INTEGER NMAX, NN, NOUT, NRHS
18* DOUBLE PRECISION THRESH
19* ..
20* .. Array Arguments ..
21* LOGICAL DOTYPE( * )
22* INTEGER IWORK( * ), NVAL( * )
23* DOUBLE PRECISION RWORK( * )
24* COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ), E( *),
25* $ WORK( * ), X( * ), XACT( * )
26* ..
27*
28*
29*> \par Purpose:
30* =============
31*>
32*> \verbatim
33*>
34*> ZDRVSY_RK tests the driver routines ZSYSV_RK.
35*> \endverbatim
36*
37* Arguments:
38* ==========
39*
40*> \param[in] DOTYPE
41*> \verbatim
42*> DOTYPE is LOGICAL array, dimension (NTYPES)
43*> The matrix types to be used for testing. Matrices of type j
44*> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
45*> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
46*> \endverbatim
47*>
48*> \param[in] NN
49*> \verbatim
50*> NN is INTEGER
51*> The number of values of N contained in the vector NVAL.
52*> \endverbatim
53*>
54*> \param[in] NVAL
55*> \verbatim
56*> NVAL is INTEGER array, dimension (NN)
57*> The values of the matrix dimension N.
58*> \endverbatim
59*>
60*> \param[in] NRHS
61*> \verbatim
62*> NRHS is INTEGER
63*> The number of right hand side vectors to be generated for
64*> each linear system.
65*> \endverbatim
66*>
67*> \param[in] THRESH
68*> \verbatim
69*> THRESH is DOUBLE PRECISION
70*> The threshold value for the test ratios. A result is
71*> included in the output file if RESULT >= THRESH. To have
72*> every test ratio printed, use THRESH = 0.
73*> \endverbatim
74*>
75*> \param[in] TSTERR
76*> \verbatim
77*> TSTERR is LOGICAL
78*> Flag that indicates whether error exits are to be tested.
79*> \endverbatim
80*>
81*> \param[in] NMAX
82*> \verbatim
83*> NMAX is INTEGER
84*> The maximum value permitted for N, used in dimensioning the
85*> work arrays.
86*> \endverbatim
87*>
88*> \param[out] A
89*> \verbatim
90*> A is COMPLEX*16 array, dimension (NMAX*NMAX)
91*> \endverbatim
92*>
93*> \param[out] AFAC
94*> \verbatim
95*> AFAC is COMPLEX*16 array, dimension (NMAX*NMAX)
96*> \endverbatim
97*>
98*> \param[out] E
99*> \verbatim
100*> E is COMPLEX*16 array, dimension (NMAX)
101*> \endverbatim
102*>
103*> \param[out] AINV
104*> \verbatim
105*> AINV is COMPLEX*16 array, dimension (NMAX*NMAX)
106*> \endverbatim
107*>
108*> \param[out] B
109*> \verbatim
110*> B is COMPLEX*16 array, dimension (NMAX*NRHS)
111*> \endverbatim
112*>
113*> \param[out] X
114*> \verbatim
115*> X is COMPLEX*16 array, dimension (NMAX*NRHS)
116*> \endverbatim
117*>
118*> \param[out] XACT
119*> \verbatim
120*> XACT is COMPLEX*16 array, dimension (NMAX*NRHS)
121*> \endverbatim
122*>
123*> \param[out] WORK
124*> \verbatim
125*> WORK is COMPLEX*16 array, dimension (NMAX*max(2,NRHS))
126*> \endverbatim
127*>
128*> \param[out] RWORK
129*> \verbatim
130*> RWORK is DOUBLE PRECISION array, dimension (NMAX+2*NRHS)
131*> \endverbatim
132*>
133*> \param[out] IWORK
134*> \verbatim
135*> IWORK is INTEGER array, dimension (NMAX)
136*> \endverbatim
137*>
138*> \param[in] NOUT
139*> \verbatim
140*> NOUT is INTEGER
141*> The unit number for output.
142*> \endverbatim
143*
144* Authors:
145* ========
146*
147*> \author Univ. of Tennessee
148*> \author Univ. of California Berkeley
149*> \author Univ. of Colorado Denver
150*> \author NAG Ltd.
151*
152*> \ingroup complex16_lin
153*
154* =====================================================================
155 SUBROUTINE zdrvsy_rk( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR,
156 $ NMAX, A, AFAC, E, AINV, B, X, XACT, WORK,
157 $ RWORK, IWORK, NOUT )
158*
159* -- LAPACK test routine --
160* -- LAPACK is a software package provided by Univ. of Tennessee, --
161* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
162*
163* .. Scalar Arguments ..
164 LOGICAL TSTERR
165 INTEGER NMAX, NN, NOUT, NRHS
166 DOUBLE PRECISION THRESH
167* ..
168* .. Array Arguments ..
169 LOGICAL DOTYPE( * )
170 INTEGER IWORK( * ), NVAL( * )
171 DOUBLE PRECISION RWORK( * )
172 COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ), E( * ),
173 $ work( * ), x( * ), xact( * )
174* ..
175*
176* =====================================================================
177*
178* .. Parameters ..
179 DOUBLE PRECISION ONE, ZERO
180 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0 )
181 INTEGER NTYPES, NTESTS
182 parameter( ntypes = 11, ntests = 3 )
183 INTEGER NFACT
184 parameter( nfact = 2 )
185* ..
186* .. Local Scalars ..
187 LOGICAL ZEROT
188 CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
189 CHARACTER*3 MATPATH, PATH
190 INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
191 $ izero, j, k, kl, ku, lda, lwork, mode, n,
192 $ nb, nbmin, nerrs, nfail, nimat, nrun, nt
193 DOUBLE PRECISION AINVNM, ANORM, CNDNUM, RCONDC
194* ..
195* .. Local Arrays ..
196 CHARACTER FACTS( NFACT ), UPLOS( 2 )
197 INTEGER ISEED( 4 ), ISEEDY( 4 )
198 DOUBLE PRECISION RESULT( NTESTS )
199
200* ..
201* .. External Functions ..
202 DOUBLE PRECISION ZLANSY
203 EXTERNAL ZLANSY
204* ..
205* .. External Subroutines ..
206 EXTERNAL aladhd, alaerh, alasvm, xlaenv, zerrvx, zget04,
209* ..
210* .. Scalars in Common ..
211 LOGICAL LERR, OK
212 CHARACTER*32 SRNAMT
213 INTEGER INFOT, NUNIT
214* ..
215* .. Common blocks ..
216 COMMON / infoc / infot, nunit, ok, lerr
217 COMMON / srnamc / srnamt
218* ..
219* .. Intrinsic Functions ..
220 INTRINSIC max, min
221* ..
222* .. Data statements ..
223 DATA iseedy / 1988, 1989, 1990, 1991 /
224 DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
225* ..
226* .. Executable Statements ..
227*
228* Initialize constants and the random number seed.
229*
230* Test path
231*
232 path( 1: 1 ) = 'Zomplex precision'
233 path( 2: 3 ) = 'SK'
234*
235* Path to generate matrices
236*
237 matpath( 1: 1 ) = 'Zomplex precision'
238 matpath( 2: 3 ) = 'SY'
239*
240 nrun = 0
241 nfail = 0
242 nerrs = 0
243 DO 10 i = 1, 4
244 iseed( i ) = iseedy( i )
245 10 CONTINUE
246 lwork = max( 2*nmax, nmax*nrhs )
247*
248* Test the error exits
249*
250 IF( tsterr )
251 $ CALL zerrvx( path, nout )
252 infot = 0
253*
254* Set the block size and minimum block size for which the block
255* routine should be used, which will be later returned by ILAENV.
256*
257 nb = 1
258 nbmin = 2
259 CALL xlaenv( 1, nb )
260 CALL xlaenv( 2, nbmin )
261*
262* Do for each value of N in NVAL
263*
264 DO 180 in = 1, nn
265 n = nval( in )
266 lda = max( n, 1 )
267 xtype = 'N'
268 nimat = ntypes
269 IF( n.LE.0 )
270 $ nimat = 1
271*
272 DO 170 imat = 1, nimat
273*
274* Do the tests only if DOTYPE( IMAT ) is true.
275*
276 IF( .NOT.dotype( imat ) )
277 $ GO TO 170
278*
279* Skip types 3, 4, 5, or 6 if the matrix size is too small.
280*
281 zerot = imat.GE.3 .AND. imat.LE.6
282 IF( zerot .AND. n.LT.imat-2 )
283 $ GO TO 170
284*
285* Do first for UPLO = 'U', then for UPLO = 'L'
286*
287 DO 160 iuplo = 1, 2
288 uplo = uplos( iuplo )
289*
290 IF( imat.NE.ntypes ) THEN
291*
292* Begin generate the test matrix A.
293*
294* Set up parameters with ZLATB4 for the matrix generator
295* based on the type of matrix to be generated.
296*
297 CALL zlatb4( matpath, imat, n, n, TYPE, kl, ku, anorm,
298 $ mode, cndnum, dist )
299*
300* Generate a matrix with ZLATMS.
301*
302 srnamt = 'ZLATMS'
303 CALL zlatms( n, n, dist, iseed, TYPE, rwork, mode,
304 $ cndnum, anorm, kl, ku, uplo, a, lda,
305 $ work, info )
306*
307* Check error code from DLATMS and handle error.
308*
309 IF( info.NE.0 ) THEN
310 CALL alaerh( path, 'ZLATMS', info, 0, uplo, n, n,
311 $ -1, -1, -1, imat, nfail, nerrs, nout )
312 GO TO 160
313 END IF
314*
315* For types 3-6, zero one or more rows and columns of
316* the matrix to test that INFO is returned correctly.
317*
318 IF( zerot ) THEN
319 IF( imat.EQ.3 ) THEN
320 izero = 1
321 ELSE IF( imat.EQ.4 ) THEN
322 izero = n
323 ELSE
324 izero = n / 2 + 1
325 END IF
326*
327 IF( imat.LT.6 ) THEN
328*
329* Set row and column IZERO to zero.
330*
331 IF( iuplo.EQ.1 ) THEN
332 ioff = ( izero-1 )*lda
333 DO 20 i = 1, izero - 1
334 a( ioff+i ) = zero
335 20 CONTINUE
336 ioff = ioff + izero
337 DO 30 i = izero, n
338 a( ioff ) = zero
339 ioff = ioff + lda
340 30 CONTINUE
341 ELSE
342 ioff = izero
343 DO 40 i = 1, izero - 1
344 a( ioff ) = zero
345 ioff = ioff + lda
346 40 CONTINUE
347 ioff = ioff - izero
348 DO 50 i = izero, n
349 a( ioff+i ) = zero
350 50 CONTINUE
351 END IF
352 ELSE
353 IF( iuplo.EQ.1 ) THEN
354*
355* Set the first IZERO rows and columns to zero.
356*
357 ioff = 0
358 DO 70 j = 1, n
359 i2 = min( j, izero )
360 DO 60 i = 1, i2
361 a( ioff+i ) = zero
362 60 CONTINUE
363 ioff = ioff + lda
364 70 CONTINUE
365 ELSE
366*
367* Set the first IZERO rows and columns to zero.
368*
369 ioff = 0
370 DO 90 j = 1, n
371 i1 = max( j, izero )
372 DO 80 i = i1, n
373 a( ioff+i ) = zero
374 80 CONTINUE
375 ioff = ioff + lda
376 90 CONTINUE
377 END IF
378 END IF
379 ELSE
380 izero = 0
381 END IF
382 ELSE
383*
384* IMAT = NTYPES: Use a special block diagonal matrix to
385* test alternate code for the 2-by-2 blocks.
386*
387 CALL zlatsy( uplo, n, a, lda, iseed )
388 END IF
389*
390 DO 150 ifact = 1, nfact
391*
392* Do first for FACT = 'F', then for other values.
393*
394 fact = facts( ifact )
395*
396* Compute the condition number for comparison with
397* the value returned by ZSYSVX_ROOK.
398*
399 IF( zerot ) THEN
400 IF( ifact.EQ.1 )
401 $ GO TO 150
402 rcondc = zero
403*
404 ELSE IF( ifact.EQ.1 ) THEN
405*
406* Compute the 1-norm of A.
407*
408 anorm = zlansy( '1', uplo, n, a, lda, rwork )
409*
410* Factor the matrix A.
411*
412
413 CALL zlacpy( uplo, n, n, a, lda, afac, lda )
414 CALL zsytrf_rk( uplo, n, afac, lda, e, iwork, ainv,
415 $ lwork, info )
416*
417* Compute inv(A) and take its norm.
418*
419 CALL zlacpy( uplo, n, n, afac, lda, ainv, lda )
420 lwork = (n+nb+1)*(nb+3)
421*
422* We need to compute the inverse to compute
423* RCONDC that is used later in TEST3.
424*
425 CALL zsytri_3( uplo, n, ainv, lda, e, iwork,
426 $ work, lwork, info )
427 ainvnm = zlansy( '1', uplo, n, ainv, lda, rwork )
428*
429* Compute the 1-norm condition number of A.
430*
431 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
432 rcondc = one
433 ELSE
434 rcondc = ( one / anorm ) / ainvnm
435 END IF
436 END IF
437*
438* Form an exact solution and set the right hand side.
439*
440 srnamt = 'ZLARHS'
441 CALL zlarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
442 $ nrhs, a, lda, xact, lda, b, lda, iseed,
443 $ info )
444 xtype = 'C'
445*
446* --- Test ZSYSV_RK ---
447*
448 IF( ifact.EQ.2 ) THEN
449 CALL zlacpy( uplo, n, n, a, lda, afac, lda )
450 CALL zlacpy( 'Full', n, nrhs, b, lda, x, lda )
451*
452* Factor the matrix and solve the system using
453* ZSYSV_RK.
454*
455 srnamt = 'ZSYSV_RK'
456 CALL zsysv_rk( uplo, n, nrhs, afac, lda, e, iwork,
457 $ x, lda, work, lwork, info )
458*
459* Adjust the expected value of INFO to account for
460* pivoting.
461*
462 k = izero
463 IF( k.GT.0 ) THEN
464 100 CONTINUE
465 IF( iwork( k ).LT.0 ) THEN
466 IF( iwork( k ).NE.-k ) THEN
467 k = -iwork( k )
468 GO TO 100
469 END IF
470 ELSE IF( iwork( k ).NE.k ) THEN
471 k = iwork( k )
472 GO TO 100
473 END IF
474 END IF
475*
476* Check error code from ZSYSV_RK and handle error.
477*
478 IF( info.NE.k ) THEN
479 CALL alaerh( path, 'ZSYSV_RK', info, k, uplo,
480 $ n, n, -1, -1, nrhs, imat, nfail,
481 $ nerrs, nout )
482 GO TO 120
483 ELSE IF( info.NE.0 ) THEN
484 GO TO 120
485 END IF
486*
487*+ TEST 1 Reconstruct matrix from factors and compute
488* residual.
489*
490 CALL zsyt01_3( uplo, n, a, lda, afac, lda, e,
491 $ iwork, ainv, lda, rwork,
492 $ result( 1 ) )
493*
494*+ TEST 2 Compute residual of the computed solution.
495*
496 CALL zlacpy( 'Full', n, nrhs, b, lda, work, lda )
497 CALL zsyt02( uplo, n, nrhs, a, lda, x, lda, work,
498 $ lda, rwork, result( 2 ) )
499*
500*+ TEST 3
501* Check solution from generated exact solution.
502*
503 CALL zget04( n, nrhs, x, lda, xact, lda, rcondc,
504 $ result( 3 ) )
505 nt = 3
506*
507* Print information about the tests that did not pass
508* the threshold.
509*
510 DO 110 k = 1, nt
511 IF( result( k ).GE.thresh ) THEN
512 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
513 $ CALL aladhd( nout, path )
514 WRITE( nout, fmt = 9999 )'ZSYSV_RK', uplo,
515 $ n, imat, k, result( k )
516 nfail = nfail + 1
517 END IF
518 110 CONTINUE
519 nrun = nrun + nt
520 120 CONTINUE
521 END IF
522*
523 150 CONTINUE
524*
525 160 CONTINUE
526 170 CONTINUE
527 180 CONTINUE
528*
529* Print a summary of the results.
530*
531 CALL alasvm( path, nout, nfail, nrun, nerrs )
532*
533 9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
534 $ ', test ', i2, ', ratio =', g12.5 )
535 RETURN
536*
537* End of ZDRVSY_RK
538*
539 END
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
Definition alasvm.f:73
subroutine xlaenv(ispec, nvalue)
XLAENV
Definition xlaenv.f:81
subroutine zlarhs(path, xtype, uplo, trans, m, n, kl, ku, nrhs, a, lda, x, ldx, b, ldb, iseed, info)
ZLARHS
Definition zlarhs.f:208
subroutine aladhd(iounit, path)
ALADHD
Definition aladhd.f:90
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
Definition alaerh.f:147
subroutine zsysv_rk(uplo, n, nrhs, a, lda, e, ipiv, b, ldb, work, lwork, info)
ZSYSV_RK computes the solution to system of linear equations A * X = B for SY matrices
Definition zsysv_rk.f:228
subroutine zsytrf_rk(uplo, n, a, lda, e, ipiv, work, lwork, info)
ZSYTRF_RK computes the factorization of a complex symmetric indefinite matrix using the bounded Bunch...
Definition zsytrf_rk.f:259
subroutine zsytri_3(uplo, n, a, lda, e, ipiv, work, lwork, info)
ZSYTRI_3
Definition zsytri_3.f:170
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
Definition zlacpy.f:103
subroutine zdrvsy_rk(dotype, nn, nval, nrhs, thresh, tsterr, nmax, a, afac, e, ainv, b, x, xact, work, rwork, iwork, nout)
ZDRVSY_RK
Definition zdrvsy_rk.f:158
subroutine zerrvx(path, nunit)
ZERRVX
Definition zerrvx.f:55
subroutine zget04(n, nrhs, x, ldx, xact, ldxact, rcond, resid)
ZGET04
Definition zget04.f:102
subroutine zlatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
ZLATB4
Definition zlatb4.f:121
subroutine zlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
ZLATMS
Definition zlatms.f:332
subroutine zlatsy(uplo, n, x, ldx, iseed)
ZLATSY
Definition zlatsy.f:89
subroutine zsyt01_3(uplo, n, a, lda, afac, ldafac, e, ipiv, c, ldc, rwork, resid)
ZSYT01_3
Definition zsyt01_3.f:141
subroutine zsyt02(uplo, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
ZSYT02
Definition zsyt02.f:127