!!################################################################################# !! Compute the factorial of an Integer !integer Function factorial (anInteger) ! integer, intent (in) :: anInteger ! integer :: i, x ! ! x = 1 ! do i = 1, anInteger ! x = x * i ! enddo ! ! factorial = x !End Function factorial !! Returns the natural logarithm of the gamma function, ln[gamma(xx)] for xx > 0 real Function gammaLn (xx) real :: xx real :: x, y, tmp, ser real :: cof (0:5) = (/76.18009172947146, -86.50532032941677, 24.01409824083091,& -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5/) integer :: j y = xx ; x = xx tmp = x + 5.5 tmp = tmp - ((x + 0.5) * log(tmp)) ser = 1.000000000190015 do j = 0, 5 y = y + 1 ser = ser + cof(j) / y enddo gammaLn = - tmp + log (2.5066282746310005*ser / x) End Function gammaLn !! Sorts a given data series from the lowest to the highest value Subroutine upward (series, n) integer :: n real :: series (0:Ntime-1) !series (0:n-1) integer :: i, j real :: temp do i = 0, n - 2 do j = 0, n - 2 - i if ( series (j + 1) .lt. series (j) ) then temp = series (j) series (j) = series (j + 1) series (j + 1) = temp endif enddo enddo ! do i = 0, n-1 ! print*, series (i) ! enddo End Subroutine upward !!