zchkgb.f
来自「famous linear algebra library (LAPACK) p」· F 代码 · 共 603 行 · 第 1/2 页
F
603 行
SUBROUTINE ZCHKGB( DOTYPE, NM, MVAL, NN, NVAL, NNB, NBVAL, NNS,
$ NSVAL, THRESH, TSTERR, A, LA, AFAC, LAFAC, B,
$ X, XACT, WORK, RWORK, IWORK, NOUT )
*
* -- LAPACK test routine (version 3.1) --
* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
* November 2006
*
* .. Scalar Arguments ..
LOGICAL TSTERR
INTEGER LA, LAFAC, NM, NN, NNB, NNS, NOUT
DOUBLE PRECISION THRESH
* ..
* .. Array Arguments ..
LOGICAL DOTYPE( * )
INTEGER IWORK( * ), MVAL( * ), NBVAL( * ), NSVAL( * ),
$ NVAL( * )
DOUBLE PRECISION RWORK( * )
COMPLEX*16 A( * ), AFAC( * ), B( * ), WORK( * ), X( * ),
$ XACT( * )
* ..
*
* Purpose
* =======
*
* ZCHKGB tests ZGBTRF, -TRS, -RFS, and -CON
*
* Arguments
* =========
*
* DOTYPE (input) 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.
*
* NM (input) INTEGER
* The number of values of M contained in the vector MVAL.
*
* MVAL (input) INTEGER array, dimension (NM)
* The values of the matrix row dimension M.
*
* NN (input) INTEGER
* The number of values of N contained in the vector NVAL.
*
* NVAL (input) INTEGER array, dimension (NN)
* The values of the matrix column dimension N.
*
* NNB (input) INTEGER
* The number of values of NB contained in the vector NBVAL.
*
* NBVAL (input) INTEGER array, dimension (NBVAL)
* The values of the blocksize NB.
*
* NNS (input) INTEGER
* The number of values of NRHS contained in the vector NSVAL.
*
* NSVAL (input) INTEGER array, dimension (NNS)
* The values of the number of right hand sides NRHS.
*
* THRESH (input) 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.
*
* TSTERR (input) LOGICAL
* Flag that indicates whether error exits are to be tested.
*
* A (workspace) COMPLEX*16 array, dimension (LA)
*
* LA (input) INTEGER
* The length of the array A. LA >= (KLMAX+KUMAX+1)*NMAX
* where KLMAX is the largest entry in the local array KLVAL,
* KUMAX is the largest entry in the local array KUVAL and
* NMAX is the largest entry in the input array NVAL.
*
* AFAC (workspace) COMPLEX*16 array, dimension (LAFAC)
*
* LAFAC (input) INTEGER
* The length of the array AFAC. LAFAC >= (2*KLMAX+KUMAX+1)*NMAX
* where KLMAX is the largest entry in the local array KLVAL,
* KUMAX is the largest entry in the local array KUVAL and
* NMAX is the largest entry in the input array NVAL.
*
* B (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX)
*
* X (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX)
*
* XACT (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX)
*
* WORK (workspace) COMPLEX*16 array, dimension
* (NMAX*max(3,NSMAX,NMAX))
*
* RWORK (workspace) DOUBLE PRECISION array, dimension
* (max(NMAX,2*NSMAX))
*
* IWORK (workspace) INTEGER array, dimension (NMAX)
*
* NOUT (input) INTEGER
* The unit number for output.
*
* =====================================================================
*
* .. Parameters ..
DOUBLE PRECISION ONE, ZERO
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
INTEGER NTYPES, NTESTS
PARAMETER ( NTYPES = 8, NTESTS = 7 )
INTEGER NBW, NTRAN
PARAMETER ( NBW = 4, NTRAN = 3 )
* ..
* .. Local Scalars ..
LOGICAL TRFCON, ZEROT
CHARACTER DIST, NORM, TRANS, TYPE, XTYPE
CHARACTER*3 PATH
INTEGER I, I1, I2, IKL, IKU, IM, IMAT, IN, INB, INFO,
$ IOFF, IRHS, ITRAN, IZERO, J, K, KL, KOFF, KU,
$ LDA, LDAFAC, LDB, M, MODE, N, NB, NERRS, NFAIL,
$ NIMAT, NKL, NKU, NRHS, NRUN
DOUBLE PRECISION AINVNM, ANORM, ANORMI, ANORMO, CNDNUM, RCOND,
$ RCONDC, RCONDI, RCONDO
* ..
* .. Local Arrays ..
CHARACTER TRANSS( NTRAN )
INTEGER ISEED( 4 ), ISEEDY( 4 ), KLVAL( NBW ),
$ KUVAL( NBW )
DOUBLE PRECISION RESULT( NTESTS )
* ..
* .. External Functions ..
DOUBLE PRECISION DGET06, ZLANGB, ZLANGE
EXTERNAL DGET06, ZLANGB, ZLANGE
* ..
* .. External Subroutines ..
EXTERNAL ALAERH, ALAHD, ALASUM, XLAENV, ZCOPY, ZERRGE,
$ ZGBCON, ZGBRFS, ZGBT01, ZGBT02, ZGBT05, ZGBTRF,
$ ZGBTRS, ZGET04, ZLACPY, ZLARHS, ZLASET, ZLATB4,
$ ZLATMS
* ..
* .. Intrinsic Functions ..
INTRINSIC DCMPLX, MAX, MIN
* ..
* .. Scalars in Common ..
LOGICAL LERR, OK
CHARACTER*6 SRNAMT
INTEGER INFOT, NUNIT
* ..
* .. Common blocks ..
COMMON / INFOC / INFOT, NUNIT, OK, LERR
COMMON / SRNAMC / SRNAMT
* ..
* .. Data statements ..
DATA ISEEDY / 1988, 1989, 1990, 1991 / ,
$ TRANSS / 'N', 'T', 'C' /
* ..
* .. Executable Statements ..
*
* Initialize constants and the random number seed.
*
PATH( 1: 1 ) = 'Zomplex precision'
PATH( 2: 3 ) = 'GB'
NRUN = 0
NFAIL = 0
NERRS = 0
DO 10 I = 1, 4
ISEED( I ) = ISEEDY( I )
10 CONTINUE
*
* Test the error exits
*
IF( TSTERR )
$ CALL ZERRGE( PATH, NOUT )
INFOT = 0
*
* Initialize the first value for the lower and upper bandwidths.
*
KLVAL( 1 ) = 0
KUVAL( 1 ) = 0
*
* Do for each value of M in MVAL
*
DO 160 IM = 1, NM
M = MVAL( IM )
*
* Set values to use for the lower bandwidth.
*
KLVAL( 2 ) = M + ( M+1 ) / 4
*
* KLVAL( 2 ) = MAX( M-1, 0 )
*
KLVAL( 3 ) = ( 3*M-1 ) / 4
KLVAL( 4 ) = ( M+1 ) / 4
*
* Do for each value of N in NVAL
*
DO 150 IN = 1, NN
N = NVAL( IN )
XTYPE = 'N'
*
* Set values to use for the upper bandwidth.
*
KUVAL( 2 ) = N + ( N+1 ) / 4
*
* KUVAL( 2 ) = MAX( N-1, 0 )
*
KUVAL( 3 ) = ( 3*N-1 ) / 4
KUVAL( 4 ) = ( N+1 ) / 4
*
* Set limits on the number of loop iterations.
*
NKL = MIN( M+1, 4 )
IF( N.EQ.0 )
$ NKL = 2
NKU = MIN( N+1, 4 )
IF( M.EQ.0 )
$ NKU = 2
NIMAT = NTYPES
IF( M.LE.0 .OR. N.LE.0 )
$ NIMAT = 1
*
DO 140 IKL = 1, NKL
*
* Do for KL = 0, (5*M+1)/4, (3M-1)/4, and (M+1)/4. This
* order makes it easier to skip redundant values for small
* values of M.
*
KL = KLVAL( IKL )
DO 130 IKU = 1, NKU
*
* Do for KU = 0, (5*N+1)/4, (3N-1)/4, and (N+1)/4. This
* order makes it easier to skip redundant values for
* small values of N.
*
KU = KUVAL( IKU )
*
* Check that A and AFAC are big enough to generate this
* matrix.
*
LDA = KL + KU + 1
LDAFAC = 2*KL + KU + 1
IF( ( LDA*N ).GT.LA .OR. ( LDAFAC*N ).GT.LAFAC ) THEN
IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
$ CALL ALAHD( NOUT, PATH )
IF( N*( KL+KU+1 ).GT.LA ) THEN
WRITE( NOUT, FMT = 9999 )LA, M, N, KL, KU,
$ N*( KL+KU+1 )
NERRS = NERRS + 1
END IF
IF( N*( 2*KL+KU+1 ).GT.LAFAC ) THEN
WRITE( NOUT, FMT = 9998 )LAFAC, M, N, KL, KU,
$ N*( 2*KL+KU+1 )
NERRS = NERRS + 1
END IF
GO TO 130
END IF
*
DO 120 IMAT = 1, NIMAT
*
* Do the tests only if DOTYPE( IMAT ) is true.
*
IF( .NOT.DOTYPE( IMAT ) )
$ GO TO 120
*
* Skip types 2, 3, or 4 if the matrix size is too
* small.
*
ZEROT = IMAT.GE.2 .AND. IMAT.LE.4
IF( ZEROT .AND. N.LT.IMAT-1 )
$ GO TO 120
*
IF( .NOT.ZEROT .OR. .NOT.DOTYPE( 1 ) ) THEN
*
* Set up parameters with ZLATB4 and generate a
* test matrix with ZLATMS.
*
CALL ZLATB4( PATH, IMAT, M, N, TYPE, KL, KU,
$ ANORM, MODE, CNDNUM, DIST )
*
KOFF = MAX( 1, KU+2-N )
DO 20 I = 1, KOFF - 1
A( I ) = ZERO
20 CONTINUE
SRNAMT = 'ZLATMS'
CALL ZLATMS( M, N, DIST, ISEED, TYPE, RWORK,
$ MODE, CNDNUM, ANORM, KL, KU, 'Z',
$ A( KOFF ), LDA, WORK, INFO )
*
* Check the error code from ZLATMS.
*
IF( INFO.NE.0 ) THEN
CALL ALAERH( PATH, 'ZLATMS', INFO, 0, ' ', M,
$ N, KL, KU, -1, IMAT, NFAIL,
$ NERRS, NOUT )
GO TO 120
END IF
ELSE IF( IZERO.GT.0 ) THEN
*
* Use the same matrix for types 3 and 4 as for
* type 2 by copying back the zeroed out column.
*
CALL ZCOPY( I2-I1+1, B, 1, A( IOFF+I1 ), 1 )
END IF
*
* For types 2, 3, and 4, zero one or more columns of
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?