* F11XAF Example Program Text * Mark 20 Revised. NAG Copyright 2001. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER LA, NMAX PARAMETER (LA=10000,NMAX=1000) * .. Local Scalars .. INTEGER I, IFAIL, N, NNZ CHARACTER CHECK, TRANS * .. Local Arrays .. DOUBLE PRECISION A(LA), X(NMAX), Y(NMAX) INTEGER ICOL(LA), IROW(LA) * .. External Subroutines .. EXTERNAL F11XAF * .. Executable Statements .. WRITE (NOUT,*) 'F11XAF Example Program Results' * Skip heading in data file READ (NIN,*) * * Read order of matrix and number of non-zero entries * READ (NIN,*) N IF (N.LE.NMAX) THEN READ (NIN,*) NNZ * * Read the matrix A * DO 20 I = 1, NNZ READ (NIN,*) A(I), IROW(I), ICOL(I) 20 CONTINUE * * Read the vector x * READ (NIN,*) (X(I),I=1,N) * * Calculate matrix-vector product * TRANS = 'N' CHECK = 'C' IFAIL = 1 CALL F11XAF(TRANS,N,NNZ,A,IROW,ICOL,CHECK,X,Y,IFAIL) IF (IFAIL.EQ.0) THEN * * Output results * WRITE (NOUT,*) WRITE (NOUT,*) ' Matrix-vector product' DO 40 I = 1, N WRITE (NOUT,'(E16.4)') Y(I) 40 CONTINUE * * Calculate transposed matrix-vector product * TRANS = 'T' CHECK = 'N' IFAIL = 1 CALL F11XAF(TRANS,N,NNZ,A,IROW,ICOL,CHECK,X,Y,IFAIL) * * Output results * WRITE (NOUT,*) WRITE (NOUT,*) ' Transposed matrix-vector product' DO 60 I = 1, N WRITE (NOUT,'(E16.4)') Y(I) 60 CONTINUE * END IF IF (IFAIL.NE.0) THEN WRITE (NOUT,99999) IFAIL END IF END IF * 99999 FORMAT (1X,/1X,' ** F11XAF returned with IFAIL = ',I5) END