Program g05sefe
! G05SEF Example Program Text
! Mark 26.1 Release. NAG Copyright 2016.
! .. Use Statements ..
Use nag_library, Only: g05kff, g05sef, nag_wp, x04caf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: lseed = 1, nin = 5, nout = 6
! .. Local Scalars ..
Integer :: genid, ifail, ldx, lstate, m, n, &
subid
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:), x(:,:)
Integer :: seed(lseed)
Integer, Allocatable :: state(:)
! .. Executable Statements ..
Write (nout,*) 'G05SEF 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 sample size and number of dimensions
Read (nin,*) n, m
ldx = n
Allocate (x(ldx,m),a(m))
! Read in the distribution parameters
Read (nin,*) a(1:m)
! Generate the variates
ifail = 0
Call g05sef(n,m,a,state,x,ldx,ifail)
! Display the variates
ifail = 0
Call x04caf('General',' ',n,m,x,ldx,' ',ifail)
End Program g05sefe