Program g01skfe ! G01SKF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: g01skf, nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Integer :: i, ifail, lk, ll, lout ! .. Local Arrays .. Real (Kind=nag_wp), Allocatable :: l(:), peqk(:), pgtk(:), plek(:) Integer, Allocatable :: ivalid(:), k(:) ! .. Intrinsic Procedures .. Intrinsic :: max, mod, repeat ! .. Executable Statements .. Write (nout,*) 'G01SKF Example Program Results' Write (nout,*) ! Skip heading in data file Read (nin,*) ! Read in the input vectors Read (nin,*) ll Allocate (l(ll)) Read (nin,*) l(1:ll) Read (nin,*) lk Allocate (k(lk)) Read (nin,*) k(1:lk) ! Allocate memory for output lout = max(ll,lk) Allocate (peqk(lout),pgtk(lout),plek(lout),ivalid(lout)) ! Calculate probability ifail = -1 Call g01skf(ll,l,lk,k,plek,pgtk,peqk,ivalid,ifail) If (ifail==0 .Or. ifail==1) Then ! Display titles Write (nout,*) & ' L K PLEK PGTK PEQK IVALID' Write (nout,*) repeat('-',58) ! Display results Do i = 1, lout Write (nout,99999) l(mod(i-1,ll)+1), k(mod(i-1,lk)+1), plek(i), & pgtk(i), peqk(i), ivalid(i) End Do End If 99999 Format (1X,F6.2,4X,I6,3(4X,F6.3),4X,I3) End Program g01skfe