Program f03bn_p0w_fe
! F03BN_P0W_F Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use iso_c_binding, Only: c_ptr
Use nagad_library, Only: f03bn_p0w_f, f07ar_p0w_f
Use nag_library, Only: nag_wp, x04daf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Real (Kind=nag_wp), Parameter :: two = 2.0_nag_wp
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Type (c_ptr) :: ad_handle
Complex (Kind=nag_wp) :: d
Integer :: i, ifail, lda, n
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:)
Integer :: id(2)
Integer, Allocatable :: ipiv(:)
! .. Intrinsic Procedures ..
Intrinsic :: aimag, real
! .. Executable Statements ..
Write (nout,*) 'F03BN_P0W_F 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 zgetrf is f07arf
ifail = 0
Call f07ar_p0w_f(ad_handle,n,n,a,lda,ipiv,ifail)
Write (nout,*)
Flush (nout)
ifail = 0
Call x04daf('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 f03bn_p0w_f(ad_handle,n,a,lda,ipiv,d,id,ifail)
Write (nout,99998) d, id
Write (nout,*)
Write (nout,99997) two**id(1)*real(d), two**id(2)*aimag(d)
99999 Format (1X,8(1X,I13))
99998 Format (1X,'D = (',F13.5,',',F13.5,'), ID = (',I0,', ',I0,')')
99997 Format (1X,'Value of determinant = (',E13.5,',',E13.5,')')
End Program f03bn_p0w_fe