PROGRAM f11mkfe ! F11MKF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f11mkf, nag_wp, x04caf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. REAL (KIND=nag_wp), PARAMETER :: alpha = 1.E0_nag_wp REAL (KIND=nag_wp), PARAMETER :: beta = 0.E0_nag_wp INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, j, ldb, ldc, m, n, nnz CHARACTER (1) :: trans ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:), b(:,:), c(:,:) INTEGER, ALLOCATABLE :: icolzp(:), irowix(:) ! .. Executable Statements .. WRITE (nout,*) 'F11MKF Example Program Results' ! Skip heading in data file READ (nin,*) ! Read order of matrix READ (nin,*) n, m ldb = n ldc = n ALLOCATE (b(ldb,m),c(ldc,m),icolzp(n+1)) ! Read the matrix A READ (nin,*) icolzp(1:n+1) nnz = icolzp(n+1) - 1 ALLOCATE (a(nnz),irowix(nnz)) DO i = 1, nnz READ (nin,*) a(i), irowix(i) END DO ! Read the matrix B DO j = 1, m READ (nin,*) b(1:n,j) END DO ! Calculate matrix-matrix product trans = 'N' ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 CALL f11mkf(trans,n,m,alpha,icolzp,irowix,a,b,ldb,beta,c,ldc,ifail) ! Output results WRITE (nout,*) FLUSH (nout) CALL x04caf('G',' ',n,m,c,ldc,'Matrix-vector product',ifail) ! Calculate transposed matrix-matrix product trans = 'T' ifail = 0 CALL f11mkf(trans,n,m,alpha,icolzp,irowix,a,b,ldb,beta,c,ldc,ifail) ! Output results WRITE (nout,*) FLUSH (nout) CALL x04caf('G',' ',n,m,c,ldc,'Transposed matrix-vector product',ifail) END PROGRAM f11mkfe