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