* F07MBF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NB, NMAX, NRHSMX PARAMETER (NB=64,NMAX=8,NRHSMX=2) INTEGER LDA, LDAF, LDB, LDX, LWORK PARAMETER (LDA=NMAX,LDAF=NMAX,LDB=NMAX,LDX=NMAX, + LWORK=NB*NMAX) * .. Local Scalars .. DOUBLE PRECISION RCOND INTEGER I, IFAIL, INFO, J, N, NRHS * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), AF(LDAF,NMAX), B(LDB,NRHSMX), + BERR(NRHSMX), FERR(NRHSMX), WORK(LWORK), + X(LDX,NRHSMX) INTEGER IPIV(NMAX), IWORK(NMAX) * .. External Subroutines .. EXTERNAL DSYSVX, X04CAF * .. Executable Statements .. WRITE (NOUT,*) 'F07MBF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N, NRHS IF (N.LE.NMAX .AND. NRHS.LE.NRHSMX) THEN * * Read the upper triangular part of A from data file * READ (NIN,*) ((A(I,J),J=I,N),I=1,N) * * Read B from data file * READ (NIN,*) ((B(I,J),J=1,NRHS),I=1,N) * * Solve the equations AX = B for X * CALL DSYSVX('Not factored','Upper',N,NRHS,A,LDA,AF,LDAF,IPIV,B, + LDB,X,LDX,RCOND,FERR,BERR,WORK,LWORK,IWORK,INFO) * IF ((INFO.EQ.0) .OR. (INFO.EQ.N+1)) THEN * * Print solution, error bounds and condition number * IFAIL = 0 CALL X04CAF('General',' ',N,NRHS,X,LDX,'Solution(s)',IFAIL) * WRITE (NOUT,*) WRITE (NOUT,*) 'Backward errors (machine-dependent)' WRITE (NOUT,99999) (BERR(J),J=1,NRHS) WRITE (NOUT,*) WRITE (NOUT,*) + 'Estimated forward error bounds (machine-dependent)' WRITE (NOUT,99999) (FERR(J),J=1,NRHS) WRITE (NOUT,*) WRITE (NOUT,*) 'Estimate of reciprocal condition number' WRITE (NOUT,99999) RCOND WRITE (NOUT,*) * IF (INFO.EQ.N+1) THEN WRITE (NOUT,*) WRITE (NOUT,*) + 'The matrix A is singular to working precision' END IF ELSE WRITE (NOUT,99998) 'The diagonal block ', INFO, + ' of D is zero' END IF ELSE WRITE (NOUT,*) 'NMAX and/or NRHSMX too small' END IF * 99999 FORMAT ((3X,1P,7E11.1)) 99998 FORMAT (1X,A,I3,A) END