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