LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
cdrvhe_aa_2stage.f
Go to the documentation of this file.
1 *> \brief \b CDRVHE_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 CDRVHE_AA_2STAGE(
12 * DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
13 * A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK,
14 * NOUT )
15 *
16 * .. Scalar Arguments ..
17 * LOGICAL TSTERR
18 * INTEGER NMAX, NN, NOUT, NRHS
19 * REAL THRESH
20 * ..
21 * .. Array Arguments ..
22 * LOGICAL DOTYPE( * )
23 * INTEGER IWORK( * ), 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 *> CDRVHE_AA_2STAGE tests the driver routine CHESV_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] NRHS
62 *> \verbatim
63 *> NRHS is INTEGER
64 *> The number of right hand side vectors to be generated for
65 *> each linear system.
66 *> \endverbatim
67 *>
68 *> \param[in] THRESH
69 *> \verbatim
70 *> THRESH is REAL
71 *> The threshold value for the test ratios. A result is
72 *> included in the output file if RESULT >= THRESH. To have
73 *> every test ratio printed, use THRESH = 0.
74 *> \endverbatim
75 *>
76 *> \param[in] TSTERR
77 *> \verbatim
78 *> TSTERR is LOGICAL
79 *> Flag that indicates whether error exits are to be tested.
80 *> \endverbatim
81 *>
82 *> \param[in] NMAX
83 *> \verbatim
84 *> NMAX is INTEGER
85 *> The maximum value permitted for N, used in dimensioning the
86 *> work arrays.
87 *> \endverbatim
88 *>
89 *> \param[out] A
90 *> \verbatim
91 *> A is COMPLEX array, dimension (NMAX*NMAX)
92 *> \endverbatim
93 *>
94 *> \param[out] AFAC
95 *> \verbatim
96 *> AFAC is COMPLEX array, dimension (NMAX*NMAX)
97 *> \endverbatim
98 *>
99 *> \param[out] AINV
100 *> \verbatim
101 *> AINV is COMPLEX array, dimension (NMAX*NMAX)
102 *> \endverbatim
103 *>
104 *> \param[out] B
105 *> \verbatim
106 *> B is COMPLEX array, dimension (NMAX*NRHS)
107 *> \endverbatim
108 *>
109 *> \param[out] X
110 *> \verbatim
111 *> X is COMPLEX array, dimension (NMAX*NRHS)
112 *> \endverbatim
113 *>
114 *> \param[out] XACT
115 *> \verbatim
116 *> XACT is COMPLEX array, dimension (NMAX*NRHS)
117 *> \endverbatim
118 *>
119 *> \param[out] WORK
120 *> \verbatim
121 *> WORK is COMPLEX array, dimension (NMAX*max(2,NRHS))
122 *> \endverbatim
123 *>
124 *> \param[out] RWORK
125 *> \verbatim
126 *> RWORK is REAL array, dimension (NMAX+2*NRHS)
127 *> \endverbatim
128 *>
129 *> \param[out] IWORK
130 *> \verbatim
131 *> IWORK is INTEGER array, dimension (NMAX)
132 *> \endverbatim
133 *>
134 *> \param[in] NOUT
135 *> \verbatim
136 *> NOUT is INTEGER
137 *> The unit number for output.
138 *> \endverbatim
139 *
140 * Authors:
141 * ========
142 *
143 *> \author Univ. of Tennessee
144 *> \author Univ. of California Berkeley
145 *> \author Univ. of Colorado Denver
146 *> \author NAG Ltd.
147 *
148 *> \date November 2017
149 *
150 *> \ingroup complex_lin
151 *
152 * =====================================================================
153  SUBROUTINE cdrvhe_aa_2stage(
154  $ DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR,
155  $ NMAX, A, AFAC, AINV, B, X, XACT, WORK,
156  $ RWORK, IWORK, NOUT )
157 *
158 * -- LAPACK test routine (version 3.8.0) --
159 * -- LAPACK is a software package provided by Univ. of Tennessee, --
160 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
161 * November 2017
162 *
163 * .. Scalar Arguments ..
164  LOGICAL TSTERR
165  INTEGER NMAX, NN, NOUT, NRHS
166  REAL THRESH
167 * ..
168 * .. Array Arguments ..
169  LOGICAL DOTYPE( * )
170  INTEGER IWORK( * ), NVAL( * )
171  REAL RWORK( * )
172  COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
173  $ work( * ), x( * ), xact( * )
174 * ..
175 *
176 * =====================================================================
177 *
178 * .. Parameters ..
179  REAL ONE, ZERO
180  parameter( one = 1.0e+0, zero = 0.0e+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  REAL ANORM, CNDNUM
194 * ..
195 * .. Local Arrays ..
196  CHARACTER FACTS( nfact ), UPLOS( 2 )
197  INTEGER ISEED( 4 ), ISEEDY( 4 )
198  REAL RESULT( ntests )
199 * ..
200 * .. External Functions ..
201  REAL CLANHE, SGET06
202  EXTERNAL clanhe, sget06
203 * ..
204 * .. External Subroutines ..
205  EXTERNAL aladhd, alaerh, alasvm, xlaenv, cerrvx,
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 cmplx, 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 ) = 'Complex precision'
233  path( 2: 3 ) = 'H2'
234 *
235 * Path to generate matrices
236 *
237  matpath( 1: 1 ) = 'Complex 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 *
247 * Test the error exits
248 *
249  IF( tsterr )
250  $ CALL cerrvx( path, nout )
251  infot = 0
252 *
253 * Set the block size and minimum block size for testing.
254 *
255  nb = 1
256  nbmin = 2
257  CALL xlaenv( 1, nb )
258  CALL xlaenv( 2, nbmin )
259 *
260 * Do for each value of N in NVAL
261 *
262  DO 180 in = 1, nn
263  n = nval( in )
264  lda = max( n, 1 )
265  xtype = 'N'
266  nimat = ntypes
267  IF( n.LE.0 )
268  $ nimat = 1
269 *
270  DO 170 imat = 1, nimat
271 *
272 * Do the tests only if DOTYPE( IMAT ) is true.
273 *
274  IF( .NOT.dotype( imat ) )
275  $ GO TO 170
276 *
277 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
278 *
279  zerot = imat.GE.3 .AND. imat.LE.6
280  IF( zerot .AND. n.LT.imat-2 )
281  $ GO TO 170
282 *
283 * Do first for UPLO = 'U', then for UPLO = 'L'
284 *
285  DO 160 iuplo = 1, 2
286  uplo = uplos( iuplo )
287 *
288 * Begin generate the test matrix A.
289 *
290 * Set up parameters with CLATB4 for the matrix generator
291 * based on the type of matrix to be generated.
292 *
293  CALL clatb4( matpath, imat, n, n, TYPE, KL, KU, ANORM,
294  $ mode, cndnum, dist )
295 *
296 * Generate a matrix with CLATMS.
297 *
298  srnamt = 'CLATMS'
299  CALL clatms( n, n, dist, iseed, TYPE, RWORK, MODE,
300  $ cndnum, anorm, kl, ku, uplo, a, lda,
301  $ work, info )
302 *
303 * Check error code from CLATMS and handle error.
304 *
305  IF( info.NE.0 ) THEN
306  CALL alaerh( path, 'CLATMS', 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  ioff = 0
350  IF( iuplo.EQ.1 ) THEN
351 *
352 * Set the first IZERO rows and columns to zero.
353 *
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  izero = 1
362  ELSE
363 *
364 * Set the first IZERO rows and columns to zero.
365 *
366  ioff = 0
367  DO 90 j = 1, n
368  i1 = max( j, izero )
369  DO 80 i = i1, n
370  a( ioff+i ) = zero
371  80 CONTINUE
372  ioff = ioff + lda
373  90 CONTINUE
374  END IF
375  END IF
376  ELSE
377  izero = 0
378  END IF
379 *
380 * End generate the test matrix A.
381 *
382 *
383  DO 150 ifact = 1, nfact
384 *
385 * Do first for FACT = 'F', then for other values.
386 *
387  fact = facts( ifact )
388 *
389 * Form an exact solution and set the right hand side.
390 *
391  srnamt = 'CLARHS'
392  CALL clarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
393  $ nrhs, a, lda, xact, lda, b, lda, iseed,
394  $ info )
395  xtype = 'C'
396 *
397 * --- Test CHESV_AA_2STAGE ---
398 *
399  IF( ifact.EQ.2 ) THEN
400  CALL clacpy( uplo, n, n, a, lda, afac, lda )
401  CALL clacpy( 'Full', n, nrhs, b, lda, x, lda )
402 *
403 * Factor the matrix and solve the system using CHESV_AA.
404 *
405  srnamt = 'CHESV_AA_2STAGE '
406  lwork = min(n*nb, 3*nmax*nmax)
407  CALL chesv_aa_2stage( uplo, n, nrhs, afac, lda,
408  $ ainv, (3*nb+1)*n,
409  $ iwork, iwork( 1+n ),
410  $ x, lda, work, lwork, info )
411 *
412 * Adjust the expected value of INFO to account for
413 * pivoting.
414 *
415  IF( izero.GT.0 ) THEN
416  j = 1
417  k = izero
418  100 CONTINUE
419  IF( j.EQ.k ) THEN
420  k = iwork( j )
421  ELSE IF( iwork( j ).EQ.k ) THEN
422  k = j
423  END IF
424  IF( j.LT.k ) THEN
425  j = j + 1
426  GO TO 100
427  END IF
428  ELSE
429  k = 0
430  END IF
431 *
432 * Check error code from CHESV_AA .
433 *
434  IF( info.NE.k ) THEN
435  CALL alaerh( path, 'CHESV_AA', info, k,
436  $ uplo, n, n, -1, -1, nrhs,
437  $ imat, nfail, nerrs, nout )
438  GO TO 120
439  ELSE IF( info.NE.0 ) THEN
440  GO TO 120
441  END IF
442 *
443 * Compute residual of the computed solution.
444 *
445  CALL clacpy( 'Full', n, nrhs, b, lda, work, lda )
446  CALL cpot02( uplo, n, nrhs, a, lda, x, lda, work,
447  $ lda, rwork, result( 1 ) )
448 *
449 * Reconstruct matrix from factors and compute
450 * residual.
451 *
452 c CALL CHET01_AA( UPLO, N, A, LDA, AFAC, LDA,
453 c $ IWORK, AINV, LDA, RWORK,
454 c $ RESULT( 2 ) )
455 c NT = 2
456  nt = 1
457 *
458 * Print information about the tests that did not pass
459 * the threshold.
460 *
461  DO 110 k = 1, nt
462  IF( result( k ).GE.thresh ) THEN
463  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
464  $ CALL aladhd( nout, path )
465  WRITE( nout, fmt = 9999 )'CHESV_AA ',
466  $ uplo, n, imat, k, result( k )
467  nfail = nfail + 1
468  END IF
469  110 CONTINUE
470  nrun = nrun + nt
471  120 CONTINUE
472  END IF
473 *
474  150 CONTINUE
475 *
476  160 CONTINUE
477  170 CONTINUE
478  180 CONTINUE
479 *
480 * Print a summary of the results.
481 *
482  CALL alasvm( path, nout, nfail, nrun, nerrs )
483 *
484  9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
485  $ ', test ', i2, ', ratio =', g12.5 )
486  RETURN
487 *
488 * End of CDRVHE_AA_2STAGE
489 *
490  END
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
Definition: alasvm.f:75
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:149
subroutine cdrvhe_aa_2stage(DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK, NOUT)
CDRVHE_AA_2STAGE
subroutine cpot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
CPOT02
Definition: cpot02.f:129
subroutine cerrvx(PATH, NUNIT)
CERRVX
Definition: cerrvx.f:57
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:83
subroutine chesv_aa_2stage(UPLO, N, NRHS, A, LDA, TB, LTB, IPIV, IPIV2, B, LDB, WORK, LWORK, INFO)
CHESV_AA_2STAGE computes the solution to system of linear equations A * X = B for HE matrices ...
subroutine chetrf_aa_2stage(UPLO, N, A, LDA, TB, LTB, IPIV, IPIV2, WORK, LWORK, INFO)
CHETRF_AA_2STAGE
subroutine aladhd(IOUNIT, PATH)
ALADHD
Definition: aladhd.f:92
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
subroutine clatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
CLATMS
Definition: clatms.f:334
subroutine clarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
CLARHS
Definition: clarhs.f:211
subroutine cget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
CGET04
Definition: cget04.f:104
subroutine clatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
CLATB4
Definition: clatb4.f:123