Program g05pyfe
! G05PYF Example Program Text
! Mark 29.2 Release. NAG Copyright 2023.
! .. Use Statements ..
Use nag_library, Only: g05kff, g05pyf, nag_wp, x04caf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: lseed = 1, nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: eps
Integer :: genid, ifail, ldc, lstate, n, subid
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: c(:,:), d(:)
Integer :: seed(lseed)
Integer, Allocatable :: state(:)
! .. Executable Statements ..
Write (nout,*) 'G05PYF Example Program Results'
Write (nout,*)
Flush (nout)
! Skip heading in data file
Read (nin,*)
! Read in the base generator information and seed
Read (nin,*) genid, subid, seed(1)
! Initial call to initializer to get size of STATE array
lstate = 0
Allocate (state(lstate))
ifail = 0
Call g05kff(genid,subid,seed,lseed,state,lstate,ifail)
! Reallocate STATE
Deallocate (state)
Allocate (state(lstate))
! Initialize the generator to a repeatable sequence
ifail = 0
Call g05kff(genid,subid,seed,lseed,state,lstate,ifail)
! Read in the problem size and tolerance
Read (nin,*) n, eps
ldc = n
Allocate (c(ldc,n),d(n))
! Read in the eigenvalues
Read (nin,*) d(1:n)
! Generate the correlation matrix
ifail = 0
Call g05pyf(n,d,eps,state,c,ldc,ifail)
! Display the results
ifail = 0
Call x04caf('General',' ',n,n,c,ldc,'Correlation Matrix',ifail)
End Program g05pyfe