PROGRAM f11xnfe ! F11XNF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f11xnf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, n, nnz CHARACTER (1) :: check, trans ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:), x(:), y(:) INTEGER, ALLOCATABLE :: icol(:), irow(:) ! .. Executable Statements .. WRITE (nout,*) 'F11XNF 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 trans = 'N' check = 'C' ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 CALL f11xnf(trans,n,nnz,a,irow,icol,check,x,y,ifail) ! Output results WRITE (nout,*) WRITE (nout,*) ' Matrix-vector product' WRITE (nout,'(1X,''('',E16.4,'','',E16.4,'')'')') y(1:n) ! Calculate conjugate transposed matrix-vector product trans = 'T' check = 'N' ifail = 0 CALL f11xnf(trans,n,nnz,a,irow,icol,check,x,y,ifail) ! Output results WRITE (nout,*) WRITE (nout,*) ' Conjugate transposed matrix-vector product' WRITE (nout,'(1X,''('',E16.4,'','',E16.4,'')'')') y(1:n) END PROGRAM f11xnfe