Program f16jsfe
! F16JSF Example Program Text
! Mark 29.2 Release. NAG Copyright 2023.
! .. Use Statements ..
Use nag_library, Only: blas_zamax_val, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: r
Integer :: i, incx, ix, k, n
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: x(:)
! .. Intrinsic Procedures ..
Intrinsic :: abs
! .. Executable Statements ..
Write (nout,*) 'F16JSF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n, incx
Allocate (x(1+(n-1)*abs(incx)))
! Read the vector x and store forwards or backwards
! as determined by incx.
If (incx>0) Then
ix = 1
Else
ix = 1 - (n-1)*incx
End If
Do i = 1, n
Read (nin,*) x(ix)
ix = ix + incx
End Do
! Find k = argmax(abs(Re(x))+abs(Im(x))) and
! r = max(abs(Re(x))+abs(Im(x))).
Call blas_zamax_val(n,x,incx,k,r)
Write (nout,*)
Write (nout,99999) k
Write (nout,99998) r
99999 Format (1X,'Index of absolutely largest component of x is',I3)
99998 Format (1X,'Absolutely largest component of x is',F12.5)
End Program f16jsfe