LAPACK  3.7.0
LAPACK: Linear Algebra PACKage
zchkhe_aa.f
Go to the documentation of this file.
1 *> \brief \b ZCHKHE_AA
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 ZCHKHE_AA( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
12 * THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
13 * XACT, WORK, RWORK, IWORK, NOUT )
14 *
15 * .. Scalar Arguments ..
16 * LOGICAL TSTERR
17 * INTEGER NN, NNB, NNS, NOUT
18 * DOUBLE PRECISION THRESH
19 * ..
20 * .. Array Arguments ..
21 * LOGICAL DOTYPE( * )
22 * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
23 * DOUBLE PRECISION RWORK( * )
24 * COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
25 * $ WORK( * ), X( * ), XACT( * )
26 * ..
27 *
28 *
29 *> \par Purpose:
30 * =============
31 *>
32 *> \verbatim
33 *>
34 *> ZCHKHE_AA tests ZHETRF_AA, -TRS_AA.
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] NNB
61 *> \verbatim
62 *> NNB is INTEGER
63 *> The number of values of NB contained in the vector NBVAL.
64 *> \endverbatim
65 *>
66 *> \param[in] NBVAL
67 *> \verbatim
68 *> NBVAL is INTEGER array, dimension (NBVAL)
69 *> The values of the blocksize NB.
70 *> \endverbatim
71 *>
72 *> \param[in] NNS
73 *> \verbatim
74 *> NNS is INTEGER
75 *> The number of values of NRHS contained in the vector NSVAL.
76 *> \endverbatim
77 *>
78 *> \param[in] NSVAL
79 *> \verbatim
80 *> NSVAL is INTEGER array, dimension (NNS)
81 *> The values of the number of right hand sides NRHS.
82 *> \endverbatim
83 *>
84 *> \param[in] THRESH
85 *> \verbatim
86 *> THRESH is DOUBLE PRECISION
87 *> The threshold value for the test ratios. A result is
88 *> included in the output file if RESULT >= THRESH. To have
89 *> every test ratio printed, use THRESH = 0.
90 *> \endverbatim
91 *>
92 *> \param[in] TSTERR
93 *> \verbatim
94 *> TSTERR is LOGICAL
95 *> Flag that indicates whether error exits are to be tested.
96 *> \endverbatim
97 *>
98 *> \param[in] NMAX
99 *> \verbatim
100 *> NMAX is INTEGER
101 *> The maximum value permitted for N, used in dimensioning the
102 *> work arrays.
103 *> \endverbatim
104 *>
105 *> \param[out] A
106 *> \verbatim
107 *> A is COMPLEX*16 array, dimension (NMAX*NMAX)
108 *> \endverbatim
109 *>
110 *> \param[out] AFAC
111 *> \verbatim
112 *> AFAC is COMPLEX*16 array, dimension (NMAX*NMAX)
113 *> \endverbatim
114 *>
115 *> \param[out] AINV
116 *> \verbatim
117 *> AINV is COMPLEX*16 array, dimension (NMAX*NMAX)
118 *> \endverbatim
119 *>
120 *> \param[out] B
121 *> \verbatim
122 *> B is COMPLEX*16 array, dimension (NMAX*NSMAX)
123 *> where NSMAX is the largest entry in NSVAL.
124 *> \endverbatim
125 *>
126 *> \param[out] X
127 *> \verbatim
128 *> X is COMPLEX*16 array, dimension (NMAX*NSMAX)
129 *> \endverbatim
130 *>
131 *> \param[out] XACT
132 *> \verbatim
133 *> XACT is COMPLEX*16 array, dimension (NMAX*NSMAX)
134 *> \endverbatim
135 *>
136 *> \param[out] WORK
137 *> \verbatim
138 *> WORK is COMPLEX*16 array, dimension (NMAX*max(3,NSMAX))
139 *> \endverbatim
140 *>
141 *> \param[out] RWORK
142 *> \verbatim
143 *> RWORK is DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX))
144 *> \endverbatim
145 *>
146 *> \param[out] IWORK
147 *> \verbatim
148 *> IWORK is INTEGER array, dimension (NMAX)
149 *> \endverbatim
150 *>
151 *> \param[in] NOUT
152 *> \verbatim
153 *> NOUT is INTEGER
154 *> The unit number for output.
155 *> \endverbatim
156 *
157 * Authors:
158 * ========
159 *
160 *> \author Univ. of Tennessee
161 *> \author Univ. of California Berkeley
162 *> \author Univ. of Colorado Denver
163 *> \author NAG Ltd.
164 *
165 *> \date December 2016
166 *
167 *
168 *> \ingroup complex16_lin
169 *
170 * =====================================================================
171  SUBROUTINE zchkhe_aa( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
172  $ thresh, tsterr, nmax, a, afac, ainv, b,
173  $ x, xact, work, rwork, iwork, nout )
174 *
175 * -- LAPACK test routine (version 3.7.0) --
176 * -- LAPACK is a software package provided by Univ. of Tennessee, --
177 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
178 * December 2016
179 *
180  IMPLICIT NONE
181 *
182 * .. Scalar Arguments ..
183  LOGICAL TSTERR
184  INTEGER NMAX, NN, NNB, NNS, NOUT
185  DOUBLE PRECISION THRESH
186 * ..
187 * .. Array Arguments ..
188  LOGICAL DOTYPE( * )
189  INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
190  DOUBLE PRECISION RWORK( * )
191  COMPLEX*16 A( * ), AFAC( * ), AINV( * ), B( * ),
192  $ work( * ), x( * ), xact( * )
193 * ..
194 *
195 * =====================================================================
196 *
197 * .. Parameters ..
198  DOUBLE PRECISION ZERO
199  parameter ( zero = 0.0d+0 )
200  COMPLEX*16 CZERO
201  parameter ( czero = ( 0.0d+0, 0.0d+0 ) )
202  INTEGER NTYPES
203  parameter ( ntypes = 10 )
204  INTEGER NTESTS
205  parameter ( ntests = 9 )
206 * ..
207 * .. Local Scalars ..
208  LOGICAL ZEROT
209  CHARACTER DIST, TYPE, UPLO, XTYPE
210  CHARACTER*3 PATH, MATPATH
211  INTEGER I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
212  $ iuplo, izero, j, k, kl, ku, lda, lwork, mode,
213  $ n, nb, nerrs, nfail, nimat, nrhs, nrun, nt
214  DOUBLE PRECISION ANORM, CNDNUM
215 * ..
216 * .. Local Arrays ..
217  CHARACTER UPLOS( 2 )
218  INTEGER ISEED( 4 ), ISEEDY( 4 )
219  DOUBLE PRECISION RESULT( ntests )
220 * ..
221 * .. External Functions ..
222  DOUBLE PRECISION DGET06, ZLANHE
223  EXTERNAL dget06, zlanhe
224 * ..
225 * .. External Subroutines ..
226  EXTERNAL alaerh, alahd, alasum, xlaenv, zerrhe, zget04,
230 * ..
231 * .. Intrinsic Functions ..
232  INTRINSIC max, min
233 * ..
234 * .. Scalars in Common ..
235  LOGICAL LERR, OK
236  CHARACTER*32 SRNAMT
237  INTEGER INFOT, NUNIT
238 * ..
239 * .. Common blocks ..
240  COMMON / infoc / infot, nunit, ok, lerr
241  COMMON / srnamc / srnamt
242 * ..
243 * .. Data statements ..
244  DATA iseedy / 1988, 1989, 1990, 1991 /
245  DATA uplos / 'U', 'L' /
246 * ..
247 * .. Executable Statements ..
248 *
249 * Initialize constants and the random number seed.
250 *
251 * Test path
252 *
253  path( 1: 1 ) = 'Zomplex precision'
254  path( 2: 3 ) = 'HA'
255 *
256 * Path to generate matrices
257 *
258  matpath( 1: 1 ) = 'Zomplex precision'
259  matpath( 2: 3 ) = 'HE'
260  nrun = 0
261  nfail = 0
262  nerrs = 0
263  DO 10 i = 1, 4
264  iseed( i ) = iseedy( i )
265  10 CONTINUE
266 *
267 * Test the error exits
268 *
269  IF( tsterr )
270  $ CALL zerrhe( path, nout )
271  infot = 0
272 *
273 * Set the minimum block size for which the block routine should
274 * be used, which will be later returned by ILAENV
275 *
276  CALL xlaenv( 2, 2 )
277 *
278 * Do for each value of N in NVAL
279 *
280  DO 180 in = 1, nn
281  n = nval( in )
282  IF( n .GT. nmax ) THEN
283  nfail = nfail + 1
284  WRITE(nout, 9995) 'M ', n, nmax
285  GO TO 180
286  END IF
287  lda = max( n, 1 )
288  xtype = 'N'
289  nimat = ntypes
290  IF( n.LE.0 )
291  $ nimat = 1
292 *
293  izero = 0
294  DO 170 imat = 1, nimat
295 *
296 * Do the tests only if DOTYPE( IMAT ) is true.
297 *
298  IF( .NOT.dotype( imat ) )
299  $ GO TO 170
300 *
301 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
302 *
303  zerot = imat.GE.3 .AND. imat.LE.6
304  IF( zerot .AND. n.LT.imat-2 )
305  $ GO TO 170
306 *
307 * Do first for UPLO = 'U', then for UPLO = 'L'
308 *
309  DO 160 iuplo = 1, 2
310  uplo = uplos( iuplo )
311 *
312 * Set up parameters with ZLATB4 for the matrix generator
313 * based on the type of matrix to be generated.
314 *
315  CALL zlatb4( matpath, imat, n, n, TYPE, KL, KU,
316  $ anorm, mode, cndnum, dist )
317 *
318 * Generate a matrix with ZLATMS.
319 *
320  srnamt = 'ZLATMS'
321  CALL zlatms( n, n, dist, iseed, TYPE, RWORK, MODE,
322  $ cndnum, anorm, kl, ku, uplo, a, lda, work,
323  $ info )
324 *
325 * Check error code from ZLATMS and handle error.
326 *
327  IF( info.NE.0 ) THEN
328  CALL alaerh( path, 'ZLATMS', info, 0, uplo, n, n, -1,
329  $ -1, -1, imat, nfail, nerrs, nout )
330 *
331 * Skip all tests for this generated matrix
332 *
333  GO TO 160
334  END IF
335 *
336 * For types 3-6, zero one or more rows and columns of
337 * the matrix to test that INFO is returned correctly.
338 *
339  IF( zerot ) THEN
340  IF( imat.EQ.3 ) THEN
341  izero = 1
342  ELSE IF( imat.EQ.4 ) THEN
343  izero = n
344  ELSE
345  izero = n / 2 + 1
346  END IF
347 *
348  IF( imat.LT.6 ) THEN
349 *
350 * Set row and column IZERO to zero.
351 *
352  IF( iuplo.EQ.1 ) THEN
353  ioff = ( izero-1 )*lda
354  DO 20 i = 1, izero - 1
355  a( ioff+i ) = czero
356  20 CONTINUE
357  ioff = ioff + izero
358  DO 30 i = izero, n
359  a( ioff ) = czero
360  ioff = ioff + lda
361  30 CONTINUE
362  ELSE
363  ioff = izero
364  DO 40 i = 1, izero - 1
365  a( ioff ) = czero
366  ioff = ioff + lda
367  40 CONTINUE
368  ioff = ioff - izero
369  DO 50 i = izero, n
370  a( ioff+i ) = czero
371  50 CONTINUE
372  END IF
373  ELSE
374  IF( iuplo.EQ.1 ) THEN
375 *
376 * Set the first IZERO rows and columns to zero.
377 *
378  ioff = 0
379  DO 70 j = 1, n
380  i2 = min( j, izero )
381  DO 60 i = 1, i2
382  a( ioff+i ) = czero
383  60 CONTINUE
384  ioff = ioff + lda
385  70 CONTINUE
386  izero = 1
387  ELSE
388 *
389 * Set the last IZERO rows and columns to zero.
390 *
391  ioff = 0
392  DO 90 j = 1, n
393  i1 = max( j, izero )
394  DO 80 i = i1, n
395  a( ioff+i ) = czero
396  80 CONTINUE
397  ioff = ioff + lda
398  90 CONTINUE
399  END IF
400  END IF
401  ELSE
402  izero = 0
403  END IF
404 *
405 * End generate test matrix A.
406 *
407 *
408 * Set the imaginary part of the diagonals.
409 *
410  CALL zlaipd( n, a, lda+1, 0 )
411 *
412 * Do for each value of NB in NBVAL
413 *
414  DO 150 inb = 1, nnb
415 *
416 * Set the optimal blocksize, which will be later
417 * returned by ILAENV.
418 *
419  nb = nbval( inb )
420  CALL xlaenv( 1, nb )
421 *
422 * Copy the test matrix A into matrix AFAC which
423 * will be factorized in place. This is needed to
424 * preserve the test matrix A for subsequent tests.
425 *
426  CALL zlacpy( uplo, n, n, a, lda, afac, lda )
427 *
428 * Compute the L*D*L**T or U*D*U**T factorization of the
429 * matrix. IWORK stores details of the interchanges and
430 * the block structure of D. AINV is a work array for
431 * block factorization, LWORK is the length of AINV.
432 *
433  lwork = max( 1, ( nb+1 )*lda )
434  srnamt = 'ZHETRF_AA'
435  CALL zhetrf_aa( uplo, n, afac, lda, iwork, ainv,
436  $ lwork, info )
437 *
438 * Adjust the expected value of INFO to account for
439 * pivoting.
440 *
441  IF( izero.GT.0 ) THEN
442  j = 1
443  k = izero
444  100 CONTINUE
445  IF( j.EQ.k ) THEN
446  k = iwork( j )
447  ELSE IF( iwork( j ).EQ.k ) THEN
448  k = j
449  END IF
450  IF( j.LT.k ) THEN
451  j = j + 1
452  GO TO 100
453  END IF
454  ELSE
455  k = 0
456  END IF
457 *
458 * Check error code from ZHETRF and handle error.
459 *
460  IF( info.NE.k ) THEN
461  CALL alaerh( path, 'ZHETRF_AA', info, k, uplo,
462  $ n, n, -1, -1, nb, imat, nfail, nerrs,
463  $ nout )
464  END IF
465 *
466 *+ TEST 1
467 * Reconstruct matrix from factors and compute residual.
468 *
469  CALL zhet01_aa( uplo, n, a, lda, afac, lda, iwork,
470  $ ainv, lda, rwork, result( 1 ) )
471  nt = 1
472 *
473 *
474 * Print information about the tests that did not pass
475 * the threshold.
476 *
477  DO 110 k = 1, nt
478  IF( result( k ).GE.thresh ) THEN
479  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
480  $ CALL alahd( nout, path )
481  WRITE( nout, fmt = 9999 )uplo, n, nb, imat, k,
482  $ result( k )
483  nfail = nfail + 1
484  END IF
485  110 CONTINUE
486  nrun = nrun + nt
487 *
488 * Skip solver test if INFO is not 0.
489 *
490  IF( info.NE.0 ) THEN
491  GO TO 140
492  END IF
493 *
494 * Do for each value of NRHS in NSVAL.
495 *
496  DO 130 irhs = 1, nns
497  nrhs = nsval( irhs )
498 *
499 *+ TEST 2 (Using TRS)
500 * Solve and compute residual for A * X = B.
501 *
502 * Choose a set of NRHS random solution vectors
503 * stored in XACT and set up the right hand side B
504 *
505  srnamt = 'ZLARHS'
506  CALL zlarhs( matpath, xtype, uplo, ' ', n, n,
507  $ kl, ku, nrhs, a, lda, xact, lda,
508  $ b, lda, iseed, info )
509  CALL zlacpy( 'Full', n, nrhs, b, lda, x, lda )
510 *
511  srnamt = 'ZHETRS_AA'
512  lwork = max( 1, 3*n-2 )
513  CALL zhetrs_aa( uplo, n, nrhs, afac, lda, iwork,
514  $ x, lda, work, lwork, info )
515 *
516 * Check error code from ZHETRS and handle error.
517 *
518  IF( info.NE.0 ) THEN
519  CALL alaerh( path, 'ZHETRS', info, 0, uplo, n,
520  $ n, -1, -1, nrhs, imat, nfail,
521  $ nerrs, nout )
522  END IF
523 *
524  CALL zlacpy( 'Full', n, nrhs, b, lda, work, lda )
525 *
526 * Compute the residual for the solution
527 *
528  CALL zpot02( uplo, n, nrhs, a, lda, x, lda, work,
529  $ lda, rwork, result( 2 ) )
530 *
531 * Print information about the tests that did not pass
532 * the threshold.
533 *
534  DO 120 k = 2, 2
535  IF( result( k ).GE.thresh ) THEN
536  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
537  $ CALL alahd( nout, path )
538  WRITE( nout, fmt = 9998 )uplo, n, nrhs,
539  $ imat, k, result( k )
540  nfail = nfail + 1
541  END IF
542  120 CONTINUE
543  nrun = nrun + 1
544 *
545 * End do for each value of NRHS in NSVAL.
546 *
547  130 CONTINUE
548  140 CONTINUE
549  150 CONTINUE
550  160 CONTINUE
551  170 CONTINUE
552  180 CONTINUE
553 *
554 * Print a summary of the results.
555 *
556  CALL alasum( path, nout, nfail, nrun, nerrs )
557 *
558  9999 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NB =', i4, ', type ',
559  $ i2, ', test ', i2, ', ratio =', g12.5 )
560  9998 FORMAT( ' UPLO = ''', a1, ''', N =', i5, ', NRHS=', i3, ', type ',
561  $ i2, ', test(', i2, ') =', g12.5 )
562 c 9997 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ',', 10X, ' type ', I2,
563 c $ ', test(', I2, ') =', G12.5 )
564  9995 FORMAT( ' Invalid input value: ', a4, '=', i6, '; must be <=',
565  $ i6 )
566  RETURN
567 *
568 * End of ZCHKHE_AA
569 *
570  END
subroutine zhetri2(UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
ZHETRI2
Definition: zhetri2.f:129
subroutine alahd(IOUNIT, PATH)
ALAHD
Definition: alahd.f:107
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:149
subroutine zget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
ZGET04
Definition: zget04.f:104
subroutine zerrhe(PATH, NUNIT)
ZERRHE
Definition: zerrhe.f:57
subroutine zpot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
ZPOT02
Definition: zpot02.f:129
subroutine zlarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
ZLARHS
Definition: zlarhs.f:211
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:105
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:83
subroutine zchkhe_aa(DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL, THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK, NOUT)
ZCHKHE_AA
Definition: zchkhe_aa.f:174
subroutine zpot03(UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK, RWORK, RCOND, RESID)
ZPOT03
Definition: zpot03.f:128
subroutine zlatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
ZLATB4
Definition: zlatb4.f:123
subroutine zhecon(UPLO, N, A, LDA, IPIV, ANORM, RCOND, WORK, INFO)
ZHECON
Definition: zhecon.f:127
subroutine zlaipd(N, A, INDA, VINDA)
ZLAIPD
Definition: zlaipd.f:85
subroutine zhetrs_aa(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
ZHETRS_AA
Definition: zhetrs_aa.f:132
subroutine zherfs(UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, RWORK, INFO)
ZHERFS
Definition: zherfs.f:194
subroutine zhetrf_aa(UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
ZHETRF_AA
Definition: zhetrf_aa.f:138
subroutine zlatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
ZLATMS
Definition: zlatms.f:334
subroutine zpot05(UPLO, N, NRHS, A, LDA, B, LDB, X, LDX, XACT, LDXACT, FERR, BERR, RESLTS)
ZPOT05
Definition: zpot05.f:167
subroutine alasum(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASUM
Definition: alasum.f:75
subroutine zhet01_aa(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
ZHET01_AA
Definition: zhet01_aa.f:127