PROGRAM f11xsfe ! F11XSF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f11xsf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, n, nnz CHARACTER (1) :: check ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:), x(:), y(:) INTEGER, ALLOCATABLE :: icol(:), irow(:) ! .. Executable Statements .. WRITE (nout,*) 'F11XSF Example Program Results' ! Skip heading in data file READ (nin,*) ! Read order of matrix and number of non-zero entries READ (nin,*) n READ (nin,*) nnz ALLOCATE (a(nnz),x(n),y(n),icol(nnz),irow(nnz)) ! Read the matrix A DO i = 1, nnz READ (nin,*) a(i), irow(i), icol(i) END DO ! Read the vector x READ (nin,*) x(1:n) ! Calculate matrix-vector product check = 'C' ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 CALL f11xsf(n,nnz,a,irow,icol,check,x,y,ifail) ! Output results WRITE (nout,*) ' Matrix-vector product' WRITE (nout,99999) y(1:n) 99999 FORMAT (1X,'(',E16.4,',',E16.4,')') END PROGRAM f11xsfe