Skip to content

Commit

Permalink
add random number generators
Browse files Browse the repository at this point in the history
  • Loading branch information
maul1609 committed Jul 28, 2019
1 parent a6b4f34 commit 34a41ad
Show file tree
Hide file tree
Showing 3 changed files with 1,624 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ osnf_lib.a : numerics.$(OBJ) zeroin.$(OBJ) sfmin.$(OBJ) \
poly_int.$(OBJ) find_pos.$(OBJ) numerics_type.$(OBJ) \
svode.$(OBJ) slinpk.$(OBJ) vode.$(OBJ) dlinpk.$(OBJ) \
vode_integrate.$(OBJ) erfinv.$(OBJ) tridiagonal.$(OBJ) \
hygfx.$(OBJ)
hygfx.$(OBJ) random.$(OBJ)
$(AR) rc osnf_lib.a numerics.$(OBJ) zeroin.$(OBJ) sfmin.$(OBJ) \
fmin.$(OBJ) r1mach.$(OBJ) \
d1mach.$(OBJ) dfsid1.$(OBJ) poly_int.$(OBJ) find_pos.$(OBJ) numerics_type.$(OBJ) \
svode.$(OBJ) slinpk.$(OBJ) vode.$(OBJ) dlinpk.$(OBJ) vode_integrate.$(OBJ) \
erfinv.$(OBJ) tridiagonal.$(OBJ) hygfx.$(OBJ)
erfinv.$(OBJ) tridiagonal.$(OBJ) hygfx.$(OBJ) random.$(OBJ)
numerics_type.$(OBJ) : numerics_type.f90
$(FOR) numerics_type.f90 $(FFLAGS)numerics_type.$(OBJ)
numerics.$(OBJ) : numerics.f90 numerics_type.$(OBJ)
Expand Down Expand Up @@ -74,6 +74,8 @@ tridiagonal.$(OBJ) : tridiagonal.f90 numerics_type.$(OBJ)
$(FOR) tridiagonal.f90 $(FFLAGS)tridiagonal.$(OBJ)
erfinv.$(OBJ) : erfinv.f90 numerics_type.$(OBJ)
$(FOR) erfinv.f90 $(FFLAGS)erfinv.$(OBJ)
random.$(OBJ) : random.f90 numerics_type.$(OBJ)
$(FOR) random.f90 $(FFLAGS)random.$(OBJ)
hygfx.$(OBJ) : hygfx.for
$(FOR) hygfx.for $(FFLAGS)hygfx.$(OBJ)
main.$(OBJ) : main.f90
Expand Down
17 changes: 17 additions & 0 deletions main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ program main
use numerics_type
use numerics, only : dvode, dfsid1, zeroin,fmin, vode_integrate, &
tridiagonal, erfinv
use random, only : random_normal
use hypergeo, only : hygfx
implicit none
real(wp) :: machep
Expand All @@ -34,6 +35,9 @@ program main
real(wp) :: x1,x2,eps,h1,hmin,f,ff1,aa,bb
real(wp), dimension(10000001) :: b,x,r
real(wp), dimension(10000000) :: a,c
integer(i4b), allocatable, dimension(:) :: seed
integer(i4b) :: l
real(wp) :: rr

external func
external func2
Expand Down Expand Up @@ -127,9 +131,22 @@ program main
call hygfx(aa, bb, real(1,sp)+2.5_wp+1.0_wp,0.5_wp,ff1)
print *,ff1

! random number
call random_seed(size=l)
allocate(seed(1:l))
seed(:)=2
call random_seed(put=seed)

do l=1,10
rr=random_normal()
print *,rr
enddo


end program main



function func(x)
use numerics_type
use numerics
Expand Down
Loading

0 comments on commit 34a41ad

Please sign in to comment.