Program g01sefe ! G01SEF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: g01sef, nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Integer :: i, ifail, la, lb, lbeta, lout, ltail ! .. Local Arrays .. Real (Kind=nag_wp), Allocatable :: a(:), b(:), beta(:), p(:) Integer, Allocatable :: ivalid(:) Character (1), Allocatable :: tail(:) ! .. Intrinsic Procedures .. Intrinsic :: max, mod, repeat ! .. Executable Statements .. Write (nout,*) 'G01SEF Example Program Results' Write (nout,*) ! Skip heading in data file Read (nin,*) ! Read in the input vectors Read (nin,*) ltail Allocate (tail(ltail)) Read (nin,*) tail(1:ltail) Read (nin,*) lbeta Allocate (beta(lbeta)) Read (nin,*) beta(1:lbeta) Read (nin,*) la Allocate (a(la)) Read (nin,*) a(1:la) Read (nin,*) lb Allocate (b(lb)) Read (nin,*) b(1:lb) ! Allocate memory for output lout = max(ltail,lbeta,la,lb) Allocate (p(lout),ivalid(lout)) ! Calculate probability ifail = -1 Call g01sef(ltail,tail,lbeta,beta,la,a,lb,b,p,ivalid,ifail) If (ifail==0 .Or. ifail==1) Then ! Display titles Write (nout,*) & ' TAIL BETA A B P IVALID' Write (nout,*) repeat('-',56) ! Display results Do i = 1, lout Write (nout,99999) tail(mod(i-1,ltail)+1), beta(mod(i-1,lbeta)+1), & a(mod(i-1,la)+1), b(mod(i-1,lb)+1), p(i), ivalid(i) End Do End If 99999 Format (5X,A1,3(4X,F6.2),4X,F6.3,4X,I3) End Program g01sefe