LAPACK  3.10.1 LAPACK: Linear Algebra PACKage
ddrvsy_aa.f
Go to the documentation of this file.
1 *> \brief \b DDRVSY_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 DDRVSY_AA( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
12 * A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK,
13 * 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 A( * ), AFAC( * ), AINV( * ), B( * ),
24 * \$ RWORK( * ), WORK( * ), X( * ), XACT( * )
25 * ..
26 *
27 *
28 *> \par Purpose:
29 * =============
30 *>
31 *> \verbatim
32 *>
33 *> DDRVSY_AA tests the driver routine DSYSV_AA.
34 *> \endverbatim
35 *
36 * Arguments:
37 * ==========
38 *
39 *> \param[in] DOTYPE
40 *> \verbatim
41 *> DOTYPE is LOGICAL array, dimension (NTYPES)
42 *> The matrix types to be used for testing. Matrices of type j
43 *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
44 *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
45 *> \endverbatim
46 *>
47 *> \param[in] NN
48 *> \verbatim
49 *> NN is INTEGER
50 *> The number of values of N contained in the vector NVAL.
51 *> \endverbatim
52 *>
53 *> \param[in] NVAL
54 *> \verbatim
55 *> NVAL is INTEGER array, dimension (NN)
56 *> The values of the matrix dimension N.
57 *> \endverbatim
58 *>
59 *> \param[in] NRHS
60 *> \verbatim
61 *> NRHS is INTEGER
62 *> The number of right hand side vectors to be generated for
63 *> each linear system.
64 *> \endverbatim
65 *>
66 *> \param[in] THRESH
67 *> \verbatim
68 *> THRESH is DOUBLE PRECISION
69 *> The threshold value for the test ratios. A result is
70 *> included in the output file if RESULT >= THRESH. To have
71 *> every test ratio printed, use THRESH = 0.
72 *> \endverbatim
73 *>
74 *> \param[in] TSTERR
75 *> \verbatim
76 *> TSTERR is LOGICAL
77 *> Flag that indicates whether error exits are to be tested.
78 *> \endverbatim
79 *>
80 *> \param[in] NMAX
81 *> \verbatim
82 *> NMAX is INTEGER
83 *> The maximum value permitted for N, used in dimensioning the
84 *> work arrays.
85 *> \endverbatim
86 *>
87 *> \param[out] A
88 *> \verbatim
89 *> A is DOUBLE PRECISION array, dimension (NMAX*NMAX)
90 *> \endverbatim
91 *>
92 *> \param[out] AFAC
93 *> \verbatim
94 *> AFAC is DOUBLE PRECISION array, dimension (NMAX*NMAX)
95 *> \endverbatim
96 *>
97 *> \param[out] AINV
98 *> \verbatim
99 *> AINV is DOUBLE PRECISION array, dimension (NMAX*NMAX)
100 *> \endverbatim
101 *>
102 *> \param[out] B
103 *> \verbatim
104 *> B is DOUBLE PRECISION array, dimension (NMAX*NRHS)
105 *> \endverbatim
106 *>
107 *> \param[out] X
108 *> \verbatim
109 *> X is DOUBLE PRECISION array, dimension (NMAX*NRHS)
110 *> \endverbatim
111 *>
112 *> \param[out] XACT
113 *> \verbatim
114 *> XACT is DOUBLE PRECISION array, dimension (NMAX*NRHS)
115 *> \endverbatim
116 *>
117 *> \param[out] WORK
118 *> \verbatim
119 *> WORK is DOUBLE PRECISION array, dimension (NMAX*max(2,NRHS))
120 *> \endverbatim
121 *>
122 *> \param[out] RWORK
123 *> \verbatim
124 *> RWORK is DOUBLE PRECISION array, dimension (NMAX+2*NRHS)
125 *> \endverbatim
126 *>
127 *> \param[out] IWORK
128 *> \verbatim
129 *> IWORK is INTEGER array, dimension (2*NMAX)
130 *> \endverbatim
131 *>
132 *> \param[in] NOUT
133 *> \verbatim
134 *> NOUT is INTEGER
135 *> The unit number for output.
136 *> \endverbatim
137 *
138 * Authors:
139 * ========
140 *
141 *> \author Univ. of Tennessee
142 *> \author Univ. of California Berkeley
143 *> \author Univ. of Colorado Denver
144 *> \author NAG Ltd.
145 *
146 *> \ingroup double_lin
147 *
148 * =====================================================================
149  SUBROUTINE ddrvsy_aa( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR,
150  \$ NMAX, A, AFAC, AINV, B, X, XACT, WORK,
151  \$ RWORK, IWORK, NOUT )
152 *
153 * -- LAPACK test routine --
154 * -- LAPACK is a software package provided by Univ. of Tennessee, --
155 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
156 *
157 * .. Scalar Arguments ..
158  LOGICAL TSTERR
159  INTEGER NMAX, NN, NOUT, NRHS
160  DOUBLE PRECISION THRESH
161 * ..
162 * .. Array Arguments ..
163  LOGICAL DOTYPE( * )
164  INTEGER IWORK( * ), NVAL( * )
165  DOUBLE PRECISION A( * ), AFAC( * ), AINV( * ), B( * ),
166  \$ rwork( * ), work( * ), x( * ), xact( * )
167 * ..
168 *
169 * =====================================================================
170 *
171 * .. Parameters ..
172  DOUBLE PRECISION ONE, ZERO
173  PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0 )
174  INTEGER NTYPES, NTESTS
175  parameter( ntypes = 10, ntests = 3 )
176  INTEGER NFACT
177  parameter( nfact = 2 )
178 * ..
179 * .. Local Scalars ..
180  LOGICAL ZEROT
181  CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
182  CHARACTER*3 MATPATH, PATH
183  INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
184  \$ izero, j, k, kl, ku, lda, lwork, mode, n,
185  \$ nb, nbmin, nerrs, nfail, nimat, nrun, nt
186  DOUBLE PRECISION ANORM, CNDNUM
187 * ..
188 * .. Local Arrays ..
189  CHARACTER FACTS( NFACT ), UPLOS( 2 )
190  INTEGER ISEED( 4 ), ISEEDY( 4 )
191  DOUBLE PRECISION RESULT( NTESTS )
192 * ..
193 * .. External Functions ..
194  DOUBLE PRECISION DGET06, DLANSY
195  EXTERNAL DGET06, DLANSY
196 * ..
197 * .. External Subroutines ..
198  EXTERNAL aladhd, alaerh, alasvm, derrvx, dget04, dlacpy,
201 * ..
202 * .. Scalars in Common ..
203  LOGICAL LERR, OK
204  CHARACTER*32 SRNAMT
205  INTEGER INFOT, NUNIT
206 * ..
207 * .. Common blocks ..
208  COMMON / infoc / infot, nunit, ok, lerr
209  COMMON / srnamc / srnamt
210 * ..
211 * .. Intrinsic Functions ..
212  INTRINSIC max, min
213 * ..
214 * .. Data statements ..
215  DATA iseedy / 1988, 1989, 1990, 1991 /
216  DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
217 * ..
218 * .. Executable Statements ..
219 *
220 * Initialize constants and the random number seed.
221 *
222 * Test path
223 *
224  path( 1: 1 ) = 'Double precision'
225  path( 2: 3 ) = 'SA'
226 *
227 * Path to generate matrices
228 *
229  matpath( 1: 1 ) = 'Double precision'
230  matpath( 2: 3 ) = 'SY'
231 *
232  nrun = 0
233  nfail = 0
234  nerrs = 0
235  DO 10 i = 1, 4
236  iseed( i ) = iseedy( i )
237  10 CONTINUE
238 *
239 * Test the error exits
240 *
241  IF( tsterr )
242  \$ CALL derrvx( path, nout )
243  infot = 0
244 *
245 * Set the block size and minimum block size for testing.
246 *
247  nb = 1
248  nbmin = 2
249  CALL xlaenv( 1, nb )
250  CALL xlaenv( 2, nbmin )
251 *
252 * Do for each value of N in NVAL
253 *
254  DO 180 in = 1, nn
255  n = nval( in )
256  lwork = max( 3*n-2, n*(1+nb) )
257  lwork = max( lwork, 1 )
258  lda = max( n, 1 )
259  xtype = 'N'
260  nimat = ntypes
261  IF( n.LE.0 )
262  \$ nimat = 1
263 *
264  DO 170 imat = 1, nimat
265 *
266 * Do the tests only if DOTYPE( IMAT ) is true.
267 *
268  IF( .NOT.dotype( imat ) )
269  \$ GO TO 170
270 *
271 * Skip types 3, 4, 5, or 6 if the matrix size is too small.
272 *
273  zerot = imat.GE.3 .AND. imat.LE.6
274  IF( zerot .AND. n.LT.imat-2 )
275  \$ GO TO 170
276 *
277 * Do first for UPLO = 'U', then for UPLO = 'L'
278 *
279  DO 160 iuplo = 1, 2
280  uplo = uplos( iuplo )
281 *
282 * Set up parameters with DLATB4 and generate a test matrix
283 * with DLATMS.
284 *
285  CALL dlatb4( matpath, imat, n, n, TYPE, kl, ku, anorm,
286  \$ mode, cndnum, dist )
287 *
288  srnamt = 'DLATMS'
289  CALL dlatms( n, n, dist, iseed, TYPE, rwork, mode,
290  \$ cndnum, anorm, kl, ku, uplo, a, lda, work,
291  \$ info )
292 *
293 * Check error code from DLATMS.
294 *
295  IF( info.NE.0 ) THEN
296  CALL alaerh( path, 'DLATMS', info, 0, uplo, n, n, -1,
297  \$ -1, -1, imat, nfail, nerrs, nout )
298  GO TO 160
299  END IF
300 *
301 * For types 3-6, zero one or more rows and columns of the
302 * matrix to test that INFO is returned correctly.
303 *
304  IF( zerot ) THEN
305  IF( imat.EQ.3 ) THEN
306  izero = 1
307  ELSE IF( imat.EQ.4 ) THEN
308  izero = n
309  ELSE
310  izero = n / 2 + 1
311  END IF
312 *
313  IF( imat.LT.6 ) THEN
314 *
315 * Set row and column IZERO to zero.
316 *
317  IF( iuplo.EQ.1 ) THEN
318  ioff = ( izero-1 )*lda
319  DO 20 i = 1, izero - 1
320  a( ioff+i ) = zero
321  20 CONTINUE
322  ioff = ioff + izero
323  DO 30 i = izero, n
324  a( ioff ) = zero
325  ioff = ioff + lda
326  30 CONTINUE
327  ELSE
328  ioff = izero
329  DO 40 i = 1, izero - 1
330  a( ioff ) = zero
331  ioff = ioff + lda
332  40 CONTINUE
333  ioff = ioff - izero
334  DO 50 i = izero, n
335  a( ioff+i ) = zero
336  50 CONTINUE
337  END IF
338  ELSE
339  ioff = 0
340  IF( iuplo.EQ.1 ) THEN
341 *
342 * Set the first IZERO rows and columns to zero.
343 *
344  DO 70 j = 1, n
345  i2 = min( j, izero )
346  DO 60 i = 1, i2
347  a( ioff+i ) = zero
348  60 CONTINUE
349  ioff = ioff + lda
350  70 CONTINUE
351  izero = 1
352  ELSE
353 *
354 * Set the last IZERO rows and columns to zero.
355 *
356  DO 90 j = 1, n
357  i1 = max( j, izero )
358  DO 80 i = i1, n
359  a( ioff+i ) = zero
360  80 CONTINUE
361  ioff = ioff + lda
362  90 CONTINUE
363  END IF
364  END IF
365  ELSE
366  izero = 0
367  END IF
368 *
369  DO 150 ifact = 1, nfact
370 *
371 * Do first for FACT = 'F', then for other values.
372 *
373  fact = facts( ifact )
374 *
375 * Form an exact solution and set the right hand side.
376 *
377  srnamt = 'DLARHS'
378  CALL dlarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
379  \$ nrhs, a, lda, xact, lda, b, lda, iseed,
380  \$ info )
381  xtype = 'C'
382 *
383 * --- Test DSYSV_AA ---
384 *
385  IF( ifact.EQ.2 ) THEN
386  CALL dlacpy( uplo, n, n, a, lda, afac, lda )
387  CALL dlacpy( 'Full', n, nrhs, b, lda, x, lda )
388 *
389 * Factor the matrix and solve the system using DSYSV_AA.
390 *
391  srnamt = 'DSYSV_AA'
392  CALL dsysv_aa( uplo, n, nrhs, afac, lda, iwork,
393  \$ x, lda, work, lwork, info )
394 *
395 * Adjust the expected value of INFO to account for
396 * pivoting.
397 *
398  IF( izero.GT.0 ) THEN
399  j = 1
400  k = izero
401  100 CONTINUE
402  IF( j.EQ.k ) THEN
403  k = iwork( j )
404  ELSE IF( iwork( j ).EQ.k ) THEN
405  k = j
406  END IF
407  IF( j.LT.k ) THEN
408  j = j + 1
409  GO TO 100
410  END IF
411  ELSE
412  k = 0
413  END IF
414 *
415 * Check error code from DSYSV_AA .
416 *
417  IF( info.NE.k ) THEN
418  CALL alaerh( path, 'DSYSV_AA ', info, k,
419  \$ uplo, n, n, -1, -1, nrhs,
420  \$ imat, nfail, nerrs, nout )
421  GO TO 120
422  ELSE IF( info.NE.0 ) THEN
423  GO TO 120
424  END IF
425 *
426 * Reconstruct matrix from factors and compute
427 * residual.
428 *
429  CALL dsyt01_aa( uplo, n, a, lda, afac, lda,
430  \$ iwork, ainv, lda, rwork,
431  \$ result( 1 ) )
432 *
433 * Compute residual of the computed solution.
434 *
435  CALL dlacpy( 'Full', n, nrhs, b, lda, work, lda )
436  CALL dpot02( uplo, n, nrhs, a, lda, x, lda, work,
437  \$ lda, rwork, result( 2 ) )
438  nt = 2
439 *
440 * Print information about the tests that did not pass
441 * the threshold.
442 *
443  DO 110 k = 1, nt
444  IF( result( k ).GE.thresh ) THEN
445  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
446  \$ CALL aladhd( nout, path )
447  WRITE( nout, fmt = 9999 )'DSYSV_AA ',
448  \$ uplo, n, imat, k, result( k )
449  nfail = nfail + 1
450  END IF
451  110 CONTINUE
452  nrun = nrun + nt
453  120 CONTINUE
454  END IF
455 *
456  150 CONTINUE
457 *
458  160 CONTINUE
459  170 CONTINUE
460  180 CONTINUE
461 *
462 * Print a summary of the results.
463 *
464  CALL alasvm( path, nout, nfail, nrun, nerrs )
465 *
466  9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
467  \$ ', test ', i2, ', ratio =', g12.5 )
468  RETURN
469 *
470 * End of DDRVSY_AA
471 *
472  END
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
DLACPY copies all or part of one two-dimensional array to another.
Definition: dlacpy.f:103
subroutine dlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: dlaset.f:110
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
Definition: alasvm.f:73
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:81
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:147
subroutine dlarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
DLARHS
Definition: dlarhs.f:205
subroutine dget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
DGET04
Definition: dget04.f:102
subroutine dpot02(UPLO, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
DPOT02
Definition: dpot02.f:127
subroutine dsyt01_aa(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
DSYT01
Definition: dsyt01_aa.f:124
subroutine ddrvsy_aa(DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK, NOUT)
DDRVSY_AA
Definition: ddrvsy_aa.f:152
subroutine dlatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
DLATB4
Definition: dlatb4.f:120
subroutine derrvx(PATH, NUNIT)
DERRVX
Definition: derrvx.f:55
subroutine dlatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
DLATMS
Definition: dlatms.f:321
subroutine dsytrf_aa(UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO)
DSYTRF_AA
Definition: dsytrf_aa.f:132
subroutine dsysv_aa(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, LWORK, INFO)
DSYSV_AA computes the solution to system of linear equations A * X = B for SY matrices
Definition: dsysv_aa.f:162