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