3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE CCHKHE_AA( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
12 * THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
13 * XACT, WORK, RWORK, IWORK, NOUT )
15 * .. Scalar Arguments ..
17 * INTEGER NN, NNB, NNS, NOUT
20 * .. Array Arguments ..
22 * INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
24 * COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
25 * $ WORK( * ), X( * ), XACT( * )
34 *> CCHKHE_AA tests CHETRF_AA, -TRS_AA.
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.
51 *> The number of values of N contained in the vector NVAL.
56 *> NVAL is INTEGER array, dimension (NN)
57 *> The values of the matrix dimension N.
63 *> The number of values of NB contained in the vector NBVAL.
68 *> NBVAL is INTEGER array, dimension (NBVAL)
69 *> The values of the blocksize NB.
75 *> The number of values of NRHS contained in the vector NSVAL.
80 *> NSVAL is INTEGER array, dimension (NNS)
81 *> The values of the number of right hand sides NRHS.
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.
95 *> Flag that indicates whether error exits are to be tested.
101 *> The maximum value permitted for N, used in dimensioning the
107 *> A is COMPLEX array, dimension (NMAX*NMAX)
112 *> AFAC is COMPLEX array, dimension (NMAX*NMAX)
117 *> AINV is COMPLEX array, dimension (NMAX*NMAX)
122 *> B is COMPLEX array, dimension (NMAX*NSMAX)
123 *> where NSMAX is the largest entry in NSVAL.
128 *> X is COMPLEX array, dimension (NMAX*NSMAX)
133 *> XACT is COMPLEX array, dimension (NMAX*NSMAX)
138 *> WORK is COMPLEX array, dimension (NMAX*max(3,NSMAX))
143 *> RWORK is REAL array, dimension (max(NMAX,2*NSMAX))
148 *> IWORK is INTEGER array, dimension (NMAX)
154 *> The unit number for output.
160 *> \author Univ. of Tennessee
161 *> \author Univ. of California Berkeley
162 *> \author Univ. of Colorado Denver
165 *> \date November 2016
168 *> \ingroup complex_lin
170 * =====================================================================
171 SUBROUTINE CCHKHE_AA( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
172 $ THRESH, TSTERR, NMAX, A, AFAC, AINV, B,
173 $ X, XACT, WORK, RWORK, IWORK, NOUT )
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..--
182 * .. Scalar Arguments ..
184 INTEGER NMAX, NN, NNB, NNS, NOUT
187 * .. Array Arguments ..
189 INTEGER IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
191 COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
192 $ WORK( * ), X( * ), XACT( * )
195 * =====================================================================
199 PARAMETER ( ZERO = 0.0E+0 )
201 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) )
203 PARAMETER ( NTYPES = 10 )
205 PARAMETER ( NTESTS = 9 )
207 * .. Local Scalars ..
208 LOGICAL TRFCON, 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 REAL ANORM, CNDNUM, RCOND, RCONDC
218 INTEGER ISEED( 4 ), ISEEDY( 4 )
219 REAL RESULT( NTESTS )
221 * .. External Functions ..
223 EXTERNAL DGET06, CLANHE
225 * .. External Subroutines ..
226 EXTERNAL ALAERH, ALAHD, ALASUM, XLAENV, CERRHE, CGET04,
227 $ ZHECON, CHERFS, CHET01, CHETRF_AA, ZHETRI2,
228 $ CHETRS_AA, CLACPY, CLAIPD, CLARHS, CLATB4,
229 $ CLATMS, CPOT02, ZPOT03, ZPOT05
231 * .. Intrinsic Functions ..
232 INTRINSIC REAL, IMAG, MAX, MIN
234 * .. Scalars in Common ..
239 * .. Common blocks ..
240 COMMON / INFOC / INFOT, NUNIT, OK, LERR
241 COMMON / SRNAMC / SRNAMT
243 * .. Data statements ..
244 DATA ISEEDY / 1988, 1989, 1990, 1991 /
245 DATA UPLOS / 'U', 'L' /
247 * .. Executable Statements ..
249 * Initialize constants and the random number seed.
254 PATH( 1: 1 ) = 'Complex precision'
257 * Path to generate matrices
259 MATPATH( 1: 1 ) = 'Complex precision'
260 MATPATH( 2: 3 ) = 'HE'
265 ISEED( I ) = ISEEDY( I )
268 * Test the error exits
271 $ CALL CERRHE( PATH, NOUT )
274 * Set the minimum block size for which the block routine should
275 * be used, which will be later returned by ILAENV
279 * Do for each value of N in NVAL
283 IF( N .GT. NMAX ) THEN
285 WRITE(NOUT, 9995) 'M ', N, NMAX
295 DO 170 IMAT = 1, NIMAT
297 * Do the tests only if DOTYPE( IMAT ) is true.
299 IF( .NOT.DOTYPE( IMAT ) )
302 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
304 ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
305 IF( ZEROT .AND. N.LT.IMAT-2 )
308 * Do first for UPLO = 'U', then for UPLO = 'L'
311 UPLO = UPLOS( IUPLO )
313 * Set up parameters with CLATB4 for the matrix generator
314 * based on the type of matrix to be generated.
316 CALL CLATB4( MATPATH, IMAT, N, N, TYPE, KL, KU,
317 $ ANORM, MODE, CNDNUM, DIST )
319 * Generate a matrix with CLATMS.
322 CALL CLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
323 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
326 * Check error code from CLATMS and handle error.
329 CALL ALAERH( PATH, 'CLATMS', INFO, 0, UPLO, N, N, -1,
330 $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
332 * Skip all tests for this generated matrix
337 * For types 3-6, zero one or more rows and columns of
338 * the matrix to test that INFO is returned correctly.
343 ELSE IF( IMAT.EQ.4 ) THEN
351 * Set row and column IZERO to zero.
353 IF( IUPLO.EQ.1 ) THEN
354 IOFF = ( IZERO-1 )*LDA
355 DO 20 I = 1, IZERO - 1
365 DO 40 I = 1, IZERO - 1
375 IF( IUPLO.EQ.1 ) THEN
377 * Set the first IZERO rows and columns to zero.
390 * Set the last IZERO rows and columns to zero.
406 * End generate test matrix A.
409 * Set the imaginary part of the diagonals.
411 CALL CLAIPD( N, A, LDA+1, 0 )
413 * Do for each value of NB in NBVAL
417 * Set the optimal blocksize, which will be later
418 * returned by ILAENV.
423 * Copy the test matrix A into matrix AFAC which
424 * will be factorized in place. This is needed to
425 * preserve the test matrix A for subsequent tests.
427 CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
429 * Compute the L*D*L**T or U*D*U**T factorization of the
430 * matrix. IWORK stores details of the interchanges and
431 * the block structure of D. AINV is a work array for
432 * block factorization, LWORK is the length of AINV.
436 CALL CHETRF_AA( UPLO, N, AFAC, LDA, IWORK, AINV,
439 * Adjust the expected value of INFO to account for
442 IF( IZERO.GT.0 ) THEN
448 ELSE IF( IWORK( J ).EQ.K ) THEN
459 * Check error code from CHETRF and handle error.
462 CALL ALAERH( PATH, 'CHETRF_AA', INFO, K, UPLO,
463 $ N, N, -1, -1, NB, IMAT, NFAIL, NERRS,
467 * Set the condition estimate flag if the INFO is not 0.
476 * Reconstruct matrix from factors and compute residual.
478 CALL CHET01_AA( UPLO, N, A, LDA, AFAC, LDA, IWORK,
479 $ AINV, LDA, RWORK, RESULT( 1 ) )
483 * Print information about the tests that did not pass
487 IF( RESULT( K ).GE.THRESH ) THEN
488 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
489 $ CALL ALAHD( NOUT, PATH )
490 WRITE( NOUT, FMT = 9999 )UPLO, N, NB, IMAT, K,
497 * Do only the condition estimate if INFO is not 0.
504 * Do for each value of NRHS in NSVAL.
509 *+ TEST 3 (Using TRS)
510 * Solve and compute residual for A * X = B.
512 * Choose a set of NRHS random solution vectors
513 * stored in XACT and set up the right hand side B
516 CALL CLARHS( MATPATH, XTYPE, UPLO, ' ', N, N,
517 $ KL, KU, NRHS, A, LDA, XACT, LDA,
518 $ B, LDA, ISEED, INFO )
519 CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
523 CALL CHETRS_AA( UPLO, N, NRHS, AFAC, LDA, IWORK,
524 $ X, LDA, WORK, LWORK, INFO )
526 * Check error code from CHETRS and handle error.
529 CALL ALAERH( PATH, 'CHETRS_AA', INFO, 0,
530 $ UPLO, N, N, -1, -1, NRHS, IMAT,
531 $ NFAIL, NERRS, NOUT )
534 CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
536 * Compute the residual for the solution
538 CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
539 $ LDA, RWORK, RESULT( 2 ) )
541 * Print information about the tests that did not pass
545 IF( RESULT( K ).GE.THRESH ) THEN
546 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
547 $ CALL ALAHD( NOUT, PATH )
548 WRITE( NOUT, FMT = 9998 )UPLO, N, NRHS,
549 $ IMAT, K, RESULT( K )
555 * End do for each value of NRHS in NSVAL.
564 * Print a summary of the results.
566 CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
568 9999 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NB =', I4, ', type ',
569 $ I2, ', test ', I2, ', ratio =', G12.5 )
570 9998 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NRHS=', I3, ', type ',
571 $ I2, ', test(', I2, ') =', G12.5 )
572 9995 FORMAT( ' Invalid input value: ', A4, '=', I6, '; must be <=',