* F04AMF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER MMAX, NMAX, IR, LDA, LDX, LDB, LDQR PARAMETER (MMAX=8,NMAX=MMAX,IR=1,LDA=MMAX,LDX=NMAX, + LDB=MMAX,LDQR=MMAX) INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) * .. Local Scalars .. DOUBLE PRECISION EPS INTEGER I, IFAIL, J, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALPHA(NMAX), B(LDB,IR), E(NMAX), + QR(LDQR,NMAX), R(MMAX), X(LDX,IR), Y(NMAX), + Z(NMAX) INTEGER IPIV(NMAX) * .. External Functions .. DOUBLE PRECISION X02AJF EXTERNAL X02AJF * .. External Subroutines .. EXTERNAL F04AMF * .. Executable Statements .. WRITE (NOUT,*) 'F04AMF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) M, N WRITE (NOUT,*) IF (M.GT.0 .AND. M.LE.MMAX .AND. N.GT.0 .AND. N.LE.NMAX) THEN READ (NIN,*) ((A(I,J),J=1,N),(B(I,J),J=1,IR),I=1,M) EPS = X02AJF() IFAIL = 1 * CALL F04AMF(A,LDA,X,LDX,B,LDB,M,N,IR,EPS,QR,LDQR,ALPHA,E,Y,Z,R, + IPIV,IFAIL) * IF (IFAIL.EQ.0) THEN WRITE (NOUT,*) ' Solution' DO 20 I = 1, N WRITE (NOUT,99999) (X(I,J),J=1,IR) 20 CONTINUE ELSE WRITE (NOUT,99998) IFAIL END IF ELSE WRITE (NOUT,99997) 'M or N is out of range: M =', M, ' N =', N END IF * 99999 FORMAT (1X,8F9.4) 99998 FORMAT (1X,' ** F04AMF returned with IFAIL = ',I5) 99997 FORMAT (1X,A,I5,A,I5) END