Program f03bafe
! F03BAF Example Program Text
! Mark 30.2 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: dgetrf, f03baf, nag_wp, x04caf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: d
Integer :: i, id, ifail, info, lda, n
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:)
Integer, Allocatable :: ipiv(:)
! .. Executable Statements ..
Write (nout,*) 'F03BAF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n
lda = n
Allocate (a(lda,n),ipiv(n))
Read (nin,*)(a(i,1:n),i=1,n)
! LU Factorize A
! The NAG name equivalent of dgetrf is f07adf
Call dgetrf(n,n,a,lda,ipiv,info)
Write (nout,*)
Flush (nout)
ifail = 0
Call x04caf('G','N',n,n,a,lda,'Array A after factorization',ifail)
Write (nout,*)
Write (nout,*) 'Pivots'
Write (nout,99999) ipiv(1:n)
Write (nout,*)
Flush (nout)
ifail = 0
Call f03baf(n,a,lda,ipiv,d,id,ifail)
Write (nout,99998) d, id
Write (nout,*)
Write (nout,99997) d*2.0_nag_wp**id
99999 Format (1X,8(1X,I13))
99998 Format (1X,'D = ',F13.5,' ID = ',I12)
99997 Format (1X,'Value of determinant = ',E13.5)
End Program f03bafe