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