LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ ddrvsy_rook()

subroutine ddrvsy_rook ( logical, dimension( * )  dotype,
integer  nn,
integer, dimension( * )  nval,
integer  nrhs,
double precision  thresh,
logical  tsterr,
integer  nmax,
double precision, dimension( * )  a,
double precision, dimension( * )  afac,
double precision, dimension( * )  ainv,
double precision, dimension( * )  b,
double precision, dimension( * )  x,
double precision, dimension( * )  xact,
double precision, dimension( * )  work,
double precision, dimension( * )  rwork,
integer, dimension( * )  iwork,
integer  nout 
)

DDRVSY_ROOK

Purpose:
 DDRVSY_ROOK tests the driver routines DSYSV_ROOK.
Parameters
[in]DOTYPE
          DOTYPE is LOGICAL array, dimension (NTYPES)
          The matrix types to be used for testing.  Matrices of type j
          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
[in]NN
          NN is INTEGER
          The number of values of N contained in the vector NVAL.
[in]NVAL
          NVAL is INTEGER array, dimension (NN)
          The values of the matrix dimension N.
[in]NRHS
          NRHS is INTEGER
          The number of right hand side vectors to be generated for
          each linear system.
[in]THRESH
          THRESH is DOUBLE PRECISION
          The threshold value for the test ratios.  A result is
          included in the output file if RESULT >= THRESH.  To have
          every test ratio printed, use THRESH = 0.
[in]TSTERR
          TSTERR is LOGICAL
          Flag that indicates whether error exits are to be tested.
[in]NMAX
          NMAX is INTEGER
          The maximum value permitted for N, used in dimensioning the
          work arrays.
[out]A
          A is DOUBLE PRECISION array, dimension (NMAX*NMAX)
[out]AFAC
          AFAC is DOUBLE PRECISION array, dimension (NMAX*NMAX)
[out]AINV
          AINV is DOUBLE PRECISION array, dimension (NMAX*NMAX)
[out]B
          B is DOUBLE PRECISION array, dimension (NMAX*NRHS)
[out]X
          X is DOUBLE PRECISION array, dimension (NMAX*NRHS)
[out]XACT
          XACT is DOUBLE PRECISION array, dimension (NMAX*NRHS)
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (NMAX*max(2,NRHS))
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (NMAX+2*NRHS)
[out]IWORK
          IWORK is INTEGER array, dimension (2*NMAX)
[in]NOUT
          NOUT is INTEGER
          The unit number for output.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 149 of file ddrvsy_rook.f.

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 PATH, MATPATH
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 AINVNM, ANORM, CNDNUM, RCONDC
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 DLANSY
195 EXTERNAL dlansy
196* ..
197* .. External Subroutines ..
198 EXTERNAL aladhd, alaerh, alasvm, derrvx, dget04, dlacpy,
201 $ dsytri_rook,
202 $ xlaenv
203* ..
204* .. Scalars in Common ..
205 LOGICAL LERR, OK
206 CHARACTER*32 SRNAMT
207 INTEGER INFOT, NUNIT
208* ..
209* .. Common blocks ..
210 COMMON / infoc / infot, nunit, ok, lerr
211 COMMON / srnamc / srnamt
212* ..
213* .. Intrinsic Functions ..
214 INTRINSIC max, min
215* ..
216* .. Data statements ..
217 DATA iseedy / 1988, 1989, 1990, 1991 /
218 DATA uplos / 'U', 'L' / , facts / 'F', 'N' /
219* ..
220* .. Executable Statements ..
221*
222* Initialize constants and the random number seed.
223*
224* Test path
225*
226 path( 1: 1 ) = 'Double precision'
227 path( 2: 3 ) = 'SR'
228*
229* Path to generate matrices
230*
231 matpath( 1: 1 ) = 'Double precision'
232 matpath( 2: 3 ) = 'SY'
233*
234 nrun = 0
235 nfail = 0
236 nerrs = 0
237 DO 10 i = 1, 4
238 iseed( i ) = iseedy( i )
239 10 CONTINUE
240 lwork = max( 2*nmax, nmax*nrhs )
241*
242* Test the error exits
243*
244 IF( tsterr )
245 $ CALL derrvx( path, nout )
246 infot = 0
247*
248* Set the block size and minimum block size for which the block
249* routine should be used, which will be later returned by ILAENV.
250*
251 nb = 1
252 nbmin = 2
253 CALL xlaenv( 1, nb )
254 CALL xlaenv( 2, nbmin )
255*
256* Do for each value of N in NVAL
257*
258 DO 180 in = 1, nn
259 n = nval( in )
260 lda = max( n, 1 )
261 xtype = 'N'
262 nimat = ntypes
263 IF( n.LE.0 )
264 $ nimat = 1
265*
266 DO 170 imat = 1, nimat
267*
268* Do the tests only if DOTYPE( IMAT ) is true.
269*
270 IF( .NOT.dotype( imat ) )
271 $ GO TO 170
272*
273* Skip types 3, 4, 5, or 6 if the matrix size is too small.
274*
275 zerot = imat.GE.3 .AND. imat.LE.6
276 IF( zerot .AND. n.LT.imat-2 )
277 $ GO TO 170
278*
279* Do first for UPLO = 'U', then for UPLO = 'L'
280*
281 DO 160 iuplo = 1, 2
282 uplo = uplos( iuplo )
283*
284* Begin generate the test matrix A.
285*
286* Set up parameters with DLATB4 for the matrix generator
287* based on the type of matrix to be generated.
288*
289 CALL dlatb4( matpath, imat, n, n, TYPE, KL, KU, ANORM,
290 $ MODE, CNDNUM, DIST )
291*
292* Generate a matrix with DLATMS.
293*
294 srnamt = 'DLATMS'
295 CALL dlatms( n, n, dist, iseed, TYPE, RWORK, MODE,
296 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
297 $ INFO )
298*
299* Check error code from DLATMS and handle error.
300*
301 IF( info.NE.0 ) THEN
302 CALL alaerh( path, 'DLATMS', info, 0, uplo, n, n, -1,
303 $ -1, -1, imat, nfail, nerrs, nout )
304*
305* Skip all tests for this generated matrix
306*
307 GO TO 160
308 END IF
309*
310* For types 3-6, zero one or more rows and columns of the
311* matrix to test that INFO is returned correctly.
312*
313 IF( zerot ) THEN
314 IF( imat.EQ.3 ) THEN
315 izero = 1
316 ELSE IF( imat.EQ.4 ) THEN
317 izero = n
318 ELSE
319 izero = n / 2 + 1
320 END IF
321*
322 IF( imat.LT.6 ) THEN
323*
324* Set row and column IZERO to zero.
325*
326 IF( iuplo.EQ.1 ) THEN
327 ioff = ( izero-1 )*lda
328 DO 20 i = 1, izero - 1
329 a( ioff+i ) = zero
330 20 CONTINUE
331 ioff = ioff + izero
332 DO 30 i = izero, n
333 a( ioff ) = zero
334 ioff = ioff + lda
335 30 CONTINUE
336 ELSE
337 ioff = izero
338 DO 40 i = 1, izero - 1
339 a( ioff ) = zero
340 ioff = ioff + lda
341 40 CONTINUE
342 ioff = ioff - izero
343 DO 50 i = izero, n
344 a( ioff+i ) = zero
345 50 CONTINUE
346 END IF
347 ELSE
348 ioff = 0
349 IF( iuplo.EQ.1 ) THEN
350*
351* Set the first IZERO rows and columns to zero.
352*
353 DO 70 j = 1, n
354 i2 = min( j, izero )
355 DO 60 i = 1, i2
356 a( ioff+i ) = zero
357 60 CONTINUE
358 ioff = ioff + lda
359 70 CONTINUE
360 ELSE
361*
362* Set the last IZERO rows and columns to zero.
363*
364 DO 90 j = 1, n
365 i1 = max( j, izero )
366 DO 80 i = i1, n
367 a( ioff+i ) = zero
368 80 CONTINUE
369 ioff = ioff + lda
370 90 CONTINUE
371 END IF
372 END IF
373 ELSE
374 izero = 0
375 END IF
376*
377* End generate the test matrix A.
378*
379 DO 150 ifact = 1, nfact
380*
381* Do first for FACT = 'F', then for other values.
382*
383 fact = facts( ifact )
384*
385* Compute the condition number for comparison with
386* the value returned by DSYSVX_ROOK.
387*
388 IF( zerot ) THEN
389 IF( ifact.EQ.1 )
390 $ GO TO 150
391 rcondc = zero
392*
393 ELSE IF( ifact.EQ.1 ) THEN
394*
395* Compute the 1-norm of A.
396*
397 anorm = dlansy( '1', uplo, n, a, lda, rwork )
398*
399* Factor the matrix A.
400*
401 CALL dlacpy( uplo, n, n, a, lda, afac, lda )
402 CALL dsytrf_rook( uplo, n, afac, lda, iwork, work,
403 $ lwork, info )
404*
405* Compute inv(A) and take its norm.
406*
407 CALL dlacpy( uplo, n, n, afac, lda, ainv, lda )
408 lwork = (n+nb+1)*(nb+3)
409 CALL dsytri_rook( uplo, n, ainv, lda, iwork,
410 $ work, info )
411 ainvnm = dlansy( '1', uplo, n, ainv, lda, rwork )
412*
413* Compute the 1-norm condition number of A.
414*
415 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
416 rcondc = one
417 ELSE
418 rcondc = ( one / anorm ) / ainvnm
419 END IF
420 END IF
421*
422* Form an exact solution and set the right hand side.
423*
424 srnamt = 'DLARHS'
425 CALL dlarhs( matpath, xtype, uplo, ' ', n, n, kl, ku,
426 $ nrhs, a, lda, xact, lda, b, lda, iseed,
427 $ info )
428 xtype = 'C'
429*
430* --- Test DSYSV_ROOK ---
431*
432 IF( ifact.EQ.2 ) THEN
433 CALL dlacpy( uplo, n, n, a, lda, afac, lda )
434 CALL dlacpy( 'Full', n, nrhs, b, lda, x, lda )
435*
436* Factor the matrix and solve the system using
437* DSYSV_ROOK.
438*
439 srnamt = 'DSYSV_ROOK'
440 CALL dsysv_rook( uplo, n, nrhs, afac, lda, iwork,
441 $ x, lda, work, lwork, info )
442*
443* Adjust the expected value of INFO to account for
444* pivoting.
445*
446 k = izero
447 IF( k.GT.0 ) THEN
448 100 CONTINUE
449 IF( iwork( k ).LT.0 ) THEN
450 IF( iwork( k ).NE.-k ) THEN
451 k = -iwork( k )
452 GO TO 100
453 END IF
454 ELSE IF( iwork( k ).NE.k ) THEN
455 k = iwork( k )
456 GO TO 100
457 END IF
458 END IF
459*
460* Check error code from DSYSV_ROOK and handle error.
461*
462 IF( info.NE.k ) THEN
463 CALL alaerh( path, 'DSYSV_ROOK', info, k, uplo,
464 $ n, n, -1, -1, nrhs, imat, nfail,
465 $ nerrs, nout )
466 GO TO 120
467 ELSE IF( info.NE.0 ) THEN
468 GO TO 120
469 END IF
470*
471*+ TEST 1 Reconstruct matrix from factors and compute
472* residual.
473*
474 CALL dsyt01_rook( uplo, n, a, lda, afac, lda,
475 $ iwork, ainv, lda, rwork,
476 $ result( 1 ) )
477*
478*+ TEST 2 Compute residual of the computed solution.
479*
480 CALL dlacpy( 'Full', n, nrhs, b, lda, work, lda )
481 CALL dpot02( uplo, n, nrhs, a, lda, x, lda, work,
482 $ lda, rwork, result( 2 ) )
483*
484*+ TEST 3
485* Check solution from generated exact solution.
486*
487 CALL dget04( n, nrhs, x, lda, xact, lda, rcondc,
488 $ result( 3 ) )
489 nt = 3
490*
491* Print information about the tests that did not pass
492* the threshold.
493*
494 DO 110 k = 1, nt
495 IF( result( k ).GE.thresh ) THEN
496 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
497 $ CALL aladhd( nout, path )
498 WRITE( nout, fmt = 9999 )'DSYSV_ROOK', uplo,
499 $ n, imat, k, result( k )
500 nfail = nfail + 1
501 END IF
502 110 CONTINUE
503 nrun = nrun + nt
504 120 CONTINUE
505 END IF
506*
507 150 CONTINUE
508*
509 160 CONTINUE
510 170 CONTINUE
511 180 CONTINUE
512*
513* Print a summary of the results.
514*
515 CALL alasvm( path, nout, nfail, nrun, nerrs )
516*
517 9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i2,
518 $ ', test ', i2, ', ratio =', g12.5 )
519 RETURN
520*
521* End of DDRVSY_ROOK
522*
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
Definition alasvm.f:73
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 xlaenv(ispec, nvalue)
XLAENV
Definition xlaenv.f:81
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 derrvx(path, nunit)
DERRVX
Definition derrvx.f:55
subroutine dget04(n, nrhs, x, ldx, xact, ldxact, rcond, resid)
DGET04
Definition dget04.f:102
subroutine dlatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
DLATB4
Definition dlatb4.f:120
subroutine dlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
DLATMS
Definition dlatms.f:321
subroutine dpot02(uplo, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
DPOT02
Definition dpot02.f:127
subroutine dpot05(uplo, n, nrhs, a, lda, b, ldb, x, ldx, xact, ldxact, ferr, berr, reslts)
DPOT05
Definition dpot05.f:164
subroutine dsyt01_rook(uplo, n, a, lda, afac, ldafac, ipiv, c, ldc, rwork, resid)
DSYT01_ROOK
subroutine dsysv_rook(uplo, n, nrhs, a, lda, ipiv, b, ldb, work, lwork, info)
DSYSV_ROOK computes the solution to system of linear equations A * X = B for SY matrices
Definition dsysv_rook.f:204
subroutine dsytrf_rook(uplo, n, a, lda, ipiv, work, lwork, info)
DSYTRF_ROOK
subroutine dsytri_rook(uplo, n, a, lda, ipiv, work, info)
DSYTRI_ROOK
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
double precision function dlansy(norm, uplo, n, a, lda, work)
DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlansy.f:122
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
Here is the call graph for this function:
Here is the caller graph for this function: