LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zdrvsy_rook()

subroutine zdrvsy_rook ( logical, dimension( * )  dotype,
integer  nn,
integer, dimension( * )  nval,
integer  nrhs,
double precision  thresh,
logical  tsterr,
integer  nmax,
complex*16, dimension( * )  a,
complex*16, dimension( * )  afac,
complex*16, dimension( * )  ainv,
complex*16, dimension( * )  b,
complex*16, dimension( * )  x,
complex*16, dimension( * )  xact,
complex*16, dimension( * )  work,
double precision, dimension( * )  rwork,
integer, dimension( * )  iwork,
integer  nout 
)

ZDRVSY_ROOK

Purpose:
 ZDRVSY_ROOK tests the driver routines ZSYSV_ROOK.
Parameters
[in]DOTYPE
          DOTYPE is LOGICAL array, dimension (NTYPES)
          The matrix types to be used for testing.  Matrices of type j
          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
[in]NN
          NN is INTEGER
          The number of values of N contained in the vector NVAL.
[in]NVAL
          NVAL is INTEGER array, dimension (NN)
          The values of the matrix dimension N.
[in]NRHS
          NRHS is INTEGER
          The number of right hand side vectors to be generated for
          each linear system.
[in]THRESH
          THRESH is DOUBLE PRECISION
          The threshold value for the test ratios.  A result is
          included in the output file if RESULT >= THRESH.  To have
          every test ratio printed, use THRESH = 0.
[in]TSTERR
          TSTERR is LOGICAL
          Flag that indicates whether error exits are to be tested.
[in]NMAX
          NMAX is INTEGER
          The maximum value permitted for N, used in dimensioning the
          work arrays.
[out]A
          A is COMPLEX*16 array, dimension (NMAX*NMAX)
[out]AFAC
          AFAC is COMPLEX*16 array, dimension (NMAX*NMAX)
[out]AINV
          AINV is COMPLEX*16 array, dimension (NMAX*NMAX)
[out]B
          B is COMPLEX*16 array, dimension (NMAX*NRHS)
[out]X
          X is COMPLEX*16 array, dimension (NMAX*NRHS)
[out]XACT
          XACT is COMPLEX*16 array, dimension (NMAX*NRHS)
[out]WORK
          WORK is COMPLEX*16 array, dimension (NMAX*max(2,NRHS))
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (NMAX+2*NRHS)
[out]IWORK
          IWORK is INTEGER array, dimension (NMAX)
[in]NOUT
          NOUT is INTEGER
          The unit number for output.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 150 of file zdrvsy_rook.f.

153*
154* -- LAPACK test routine --
155* -- LAPACK is a software package provided by Univ. of Tennessee, --
156* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
157*
158* .. Scalar Arguments ..
159 LOGICAL TSTERR
160 INTEGER NMAX, NN, NOUT, NRHS
161 DOUBLE PRECISION THRESH
162* ..
163* .. Array Arguments ..
164 LOGICAL DOTYPE( * )
165 INTEGER IWORK( * ), NVAL( * )
166 DOUBLE PRECISION RWORK( * )
167 COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
168 $ WORK( * ), X( * ), XACT( * )
169* ..
170*
171* =====================================================================
172*
173* .. Parameters ..
174 DOUBLE PRECISION ONE, ZERO
175 parameter( one = 1.0d+0, zero = 0.0d+0 )
176 INTEGER NTYPES, NTESTS
177 parameter( ntypes = 11, ntests = 3 )
178 INTEGER NFACT
179 parameter( nfact = 2 )
180* ..
181* .. Local Scalars ..
182 LOGICAL ZEROT
183 CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
184 CHARACTER*3 MATPATH, PATH
185 INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
186 $ IZERO, J, K, KL, KU, LDA, LWORK, MODE, N,
187 $ NB, NBMIN, NERRS, NFAIL, NIMAT, NRUN, NT
188 DOUBLE PRECISION AINVNM, ANORM, CNDNUM, RCONDC
189* ..
190* .. Local Arrays ..
191 CHARACTER FACTS( NFACT ), UPLOS( 2 )
192 INTEGER ISEED( 4 ), ISEEDY( 4 )
193 DOUBLE PRECISION RESULT( NTESTS )
194
195* ..
196* .. External Functions ..
197 DOUBLE PRECISION ZLANSY
198 EXTERNAL zlansy
199* ..
200* .. External Subroutines ..
201 EXTERNAL aladhd, alaerh, alasvm, xlaenv, zerrvx, zget04,
205* ..
206* .. Scalars in Common ..
207 LOGICAL LERR, OK
208 CHARACTER*32 SRNAMT
209 INTEGER INFOT, NUNIT
210* ..
211* .. Common blocks ..
212 COMMON / infoc / infot, nunit, ok, lerr
213 COMMON / srnamc / srnamt
214* ..
215* .. Intrinsic Functions ..
216 INTRINSIC max, min
217* ..
218* .. Data statements ..
219 DATA iseedy / 1988, 1989, 1990, 1991 /
220 DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
221* ..
222* .. Executable Statements ..
223*
224* Initialize constants and the random number seed.
225*
226* Test path
227*
228 path( 1: 1 ) = 'Zomplex precision'
229 path( 2: 3 ) = 'SR'
230*
231* Path to generate matrices
232*
233 matpath( 1: 1 ) = 'Zomplex precision'
234 matpath( 2: 3 ) = 'SY'
235*
236 nrun = 0
237 nfail = 0
238 nerrs = 0
239 DO 10 i = 1, 4
240 iseed( i ) = iseedy( i )
241 10 CONTINUE
242 lwork = max( 2*nmax, nmax*nrhs )
243*
244* Test the error exits
245*
246 IF( tsterr )
247 $ CALL zerrvx( path, nout )
248 infot = 0
249*
250* Set the block size and minimum block size for which the block
251* routine should be used, which will be later returned by ILAENV.
252*
253 nb = 1
254 nbmin = 2
255 CALL xlaenv( 1, nb )
256 CALL xlaenv( 2, nbmin )
257*
258* Do for each value of N in NVAL
259*
260 DO 180 in = 1, nn
261 n = nval( in )
262 lda = max( n, 1 )
263 xtype = 'N'
264 nimat = ntypes
265 IF( n.LE.0 )
266 $ nimat = 1
267*
268 DO 170 imat = 1, nimat
269*
270* Do the tests only if DOTYPE( IMAT ) is true.
271*
272 IF( .NOT.dotype( imat ) )
273 $ GO TO 170
274*
275* Skip types 3, 4, 5, or 6 if the matrix size is too small.
276*
277 zerot = imat.GE.3 .AND. imat.LE.6
278 IF( zerot .AND. n.LT.imat-2 )
279 $ GO TO 170
280*
281* Do first for UPLO = 'U', then for UPLO = 'L'
282*
283 DO 160 iuplo = 1, 2
284 uplo = uplos( iuplo )
285*
286 IF( imat.NE.ntypes ) THEN
287*
288* Begin generate the test matrix A.
289*
290* Set up parameters with ZLATB4 for the matrix generator
291* based on the type of matrix to be generated.
292*
293 CALL zlatb4( matpath, imat, n, n, TYPE, KL, KU, ANORM,
294 $ MODE, CNDNUM, DIST )
295*
296* Generate a matrix with ZLATMS.
297*
298 srnamt = 'ZLATMS'
299 CALL zlatms( n, n, dist, iseed, TYPE, RWORK, MODE,
300 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA,
301 $ WORK, INFO )
302*
303* Check error code from DLATMS and handle error.
304*
305 IF( info.NE.0 ) THEN
306 CALL alaerh( path, 'ZLATMS', info, 0, uplo, n, n,
307 $ -1, -1, -1, imat, nfail, nerrs, nout )
308 GO TO 160
309 END IF
310*
311* For types 3-6, zero one or more rows and columns of
312* the matrix to test that INFO is returned correctly.
313*
314 IF( zerot ) THEN
315 IF( imat.EQ.3 ) THEN
316 izero = 1
317 ELSE IF( imat.EQ.4 ) THEN
318 izero = n
319 ELSE
320 izero = n / 2 + 1
321 END IF
322*
323 IF( imat.LT.6 ) THEN
324*
325* Set row and column IZERO to zero.
326*
327 IF( iuplo.EQ.1 ) THEN
328 ioff = ( izero-1 )*lda
329 DO 20 i = 1, izero - 1
330 a( ioff+i ) = zero
331 20 CONTINUE
332 ioff = ioff + izero
333 DO 30 i = izero, n
334 a( ioff ) = zero
335 ioff = ioff + lda
336 30 CONTINUE
337 ELSE
338 ioff = izero
339 DO 40 i = 1, izero - 1
340 a( ioff ) = zero
341 ioff = ioff + lda
342 40 CONTINUE
343 ioff = ioff - izero
344 DO 50 i = izero, n
345 a( ioff+i ) = zero
346 50 CONTINUE
347 END IF
348 ELSE
349 IF( iuplo.EQ.1 ) THEN
350*
351* Set the first IZERO rows and columns to zero.
352*
353 ioff = 0
354 DO 70 j = 1, n
355 i2 = min( j, izero )
356 DO 60 i = 1, i2
357 a( ioff+i ) = zero
358 60 CONTINUE
359 ioff = ioff + lda
360 70 CONTINUE
361 ELSE
362*
363* Set the first IZERO rows and columns to zero.
364*
365 ioff = 0
366 DO 90 j = 1, n
367 i1 = max( j, izero )
368 DO 80 i = i1, n
369 a( ioff+i ) = zero
370 80 CONTINUE
371 ioff = ioff + lda
372 90 CONTINUE
373 END IF
374 END IF
375 ELSE
376 izero = 0
377 END IF
378 ELSE
379*
380* IMAT = NTYPES: Use a special block diagonal matrix to
381* test alternate code for the 2-by-2 blocks.
382*
383 CALL zlatsy( uplo, n, a, lda, iseed )
384 END IF
385*
386 DO 150 ifact = 1, nfact
387*
388* Do first for FACT = 'F', then for other values.
389*
390 fact = facts( ifact )
391*
392* Compute the condition number for comparison with
393* the value returned by ZSYSVX_ROOK.
394*
395 IF( zerot ) THEN
396 IF( ifact.EQ.1 )
397 $ GO TO 150
398 rcondc = zero
399*
400 ELSE IF( ifact.EQ.1 ) THEN
401*
402* Compute the 1-norm of A.
403*
404 anorm = zlansy( '1', uplo, n, a, lda, rwork )
405*
406* Factor the matrix A.
407*
408
409 CALL zlacpy( uplo, n, n, a, lda, afac, lda )
410 CALL zsytrf_rook( uplo, n, afac, lda, iwork, work,
411 $ lwork, info )
412*
413* Compute inv(A) and take its norm.
414*
415 CALL zlacpy( uplo, n, n, afac, lda, ainv, lda )
416 lwork = (n+nb+1)*(nb+3)
417 CALL zsytri_rook( uplo, n, ainv, lda, iwork,
418 $ work, info )
419 ainvnm = zlansy( '1', uplo, n, ainv, lda, rwork )
420*
421* Compute the 1-norm condition number of A.
422*
423 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
424 rcondc = one
425 ELSE
426 rcondc = ( one / anorm ) / ainvnm
427 END IF
428 END IF
429*
430* Form an exact solution and set the right hand side.
431*
432 srnamt = 'ZLARHS'
433 CALL zlarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
434 $ nrhs, a, lda, xact, lda, b, lda, iseed,
435 $ info )
436 xtype = 'C'
437*
438* --- Test ZSYSV_ROOK ---
439*
440 IF( ifact.EQ.2 ) THEN
441 CALL zlacpy( uplo, n, n, a, lda, afac, lda )
442 CALL zlacpy( 'Full', n, nrhs, b, lda, x, lda )
443*
444* Factor the matrix and solve the system using
445* ZSYSV_ROOK.
446*
447 srnamt = 'ZSYSV_ROOK'
448 CALL zsysv_rook( uplo, n, nrhs, afac, lda, iwork,
449 $ x, lda, work, lwork, info )
450*
451* Adjust the expected value of INFO to account for
452* pivoting.
453*
454 k = izero
455 IF( k.GT.0 ) THEN
456 100 CONTINUE
457 IF( iwork( k ).LT.0 ) THEN
458 IF( iwork( k ).NE.-k ) THEN
459 k = -iwork( k )
460 GO TO 100
461 END IF
462 ELSE IF( iwork( k ).NE.k ) THEN
463 k = iwork( k )
464 GO TO 100
465 END IF
466 END IF
467*
468* Check error code from ZSYSV_ROOK and handle error.
469*
470 IF( info.NE.k ) THEN
471 CALL alaerh( path, 'ZSYSV_ROOK', info, k, uplo,
472 $ n, n, -1, -1, nrhs, imat, nfail,
473 $ nerrs, nout )
474 GO TO 120
475 ELSE IF( info.NE.0 ) THEN
476 GO TO 120
477 END IF
478*
479*+ TEST 1 Reconstruct matrix from factors and compute
480* residual.
481*
482 CALL zsyt01_rook( uplo, n, a, lda, afac, lda,
483 $ iwork, ainv, lda, rwork,
484 $ result( 1 ) )
485*
486*+ TEST 2 Compute residual of the computed solution.
487*
488 CALL zlacpy( 'Full', n, nrhs, b, lda, work, lda )
489 CALL zsyt02( uplo, n, nrhs, a, lda, x, lda, work,
490 $ lda, rwork, result( 2 ) )
491*
492*+ TEST 3
493* Check solution from generated exact solution.
494*
495 CALL zget04( n, nrhs, x, lda, xact, lda, rcondc,
496 $ result( 3 ) )
497 nt = 3
498*
499* Print information about the tests that did not pass
500* the threshold.
501*
502 DO 110 k = 1, nt
503 IF( result( k ).GE.thresh ) THEN
504 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
505 $ CALL aladhd( nout, path )
506 WRITE( nout, fmt = 9999 )'ZSYSV_ROOK', uplo,
507 $ n, imat, k, result( k )
508 nfail = nfail + 1
509 END IF
510 110 CONTINUE
511 nrun = nrun + nt
512 120 CONTINUE
513 END IF
514*
515 150 CONTINUE
516*
517 160 CONTINUE
518 170 CONTINUE
519 180 CONTINUE
520*
521* Print a summary of the results.
522*
523 CALL alasvm( path, nout, nfail, nrun, nerrs )
524*
525 9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
526 $ ', test ', i2, ', ratio =', g12.5 )
527 RETURN
528*
529* End of ZDRVSY_ROOK
530*
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_rook(uplo, n, nrhs, a, lda, ipiv, b, ldb, work, lwork, info)
ZSYSV_ROOK computes the solution to system of linear equations A * X = B for SY matrices
Definition zsysv_rook.f:204
subroutine zsytrf_rook(uplo, n, a, lda, ipiv, work, lwork, info)
ZSYTRF_ROOK
subroutine zsytri_rook(uplo, n, a, lda, ipiv, work, info)
ZSYTRI_ROOK
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
double precision function zlansy(norm, uplo, n, a, lda, work)
ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlansy.f:123
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition zlaset.f:106
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 zpot05(uplo, n, nrhs, a, lda, b, ldb, x, ldx, xact, ldxact, ferr, berr, reslts)
ZPOT05
Definition zpot05.f:165
subroutine zsyt01_rook(uplo, n, a, lda, afac, ldafac, ipiv, c, ldc, rwork, resid)
ZSYT01_ROOK
subroutine zsyt02(uplo, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
ZSYT02
Definition zsyt02.f:127
Here is the call graph for this function:
Here is the caller graph for this function: