Program f11dnfe
! F11DNF Example Program Text
! Mark 28.3 Release. NAG Copyright 2022.
! .. Use Statements ..
Use nag_library, Only: f11dnf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: dtol
Integer :: i, ifail, la, lfill, liwork, n, nnz, &
nnzc, npivm
Character (1) :: milu, pstrat
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:)
Integer, Allocatable :: icol(:), idiag(:), ipivp(:), &
ipivq(:), irow(:), istr(:), iwork(:)
! .. Executable Statements ..
Write (nout,*) 'F11DNF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
! Read algorithmic parameters
Read (nin,*) n
Read (nin,*) nnz
la = 2*nnz
liwork = 7*n + 2
Allocate (a(la),icol(la),idiag(n),ipivp(n),ipivq(n),irow(la),istr(n+1), &
iwork(liwork))
Read (nin,*) lfill, dtol
Read (nin,*) pstrat
Read (nin,*) milu
! Read the matrix A
Do i = 1, nnz
Read (nin,*) a(i), irow(i), icol(i)
End Do
! Calculate incomplete LU factorization
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call f11dnf(n,nnz,a,la,irow,icol,lfill,dtol,pstrat,milu,ipivp,ipivq, &
istr,idiag,nnzc,npivm,iwork,liwork,ifail)
! Output original matrix
Write (nout,*) ' Original Matrix'
Write (nout,'(A,I4)') ' N =', n
Write (nout,'(A,I4)') ' NNZ =', nnz
Do i = 1, nnz
Write (nout,99999) i, a(i), irow(i), icol(i)
End Do
Write (nout,*)
! Output details of the factorization
Write (nout,*) ' Factorization'
Write (nout,'(A,I4)') ' N =', n
Write (nout,'(A,I4)') ' NNZ =', nnzc
Write (nout,'(A,I4)') ' NPIVM =', npivm
Do i = nnz + 1, nnz + nnzc
Write (nout,99999) i, a(i), irow(i), icol(i)
End Do
Write (nout,*)
Write (nout,*) ' I IPIVP(I) IPIVQ(I)'
Do i = 1, n
Write (nout,'(3I10)') i, ipivp(i), ipivq(i)
End Do
99999 Format (1X,I8,5X,'(',E16.4,',',E16.4,')',2I8)
End Program f11dnfe