-
git-svn-id: https://lxsd.femto-st.fr/svn/fvn@62 b657c933-2333-4658-acf2-d3c7c2708721
test_bestime.f90
1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
program bestime
use fvn_fnlib
implicit none
real(kind=dp_kind) :: x,xmin,xmax,xstep,t1,t2,bes,b(51)
integer(kind=ip_kind) :: npoints,iter,n,i,it,nn
iter=10000
n=10
npoints=200
xmin=-50.
xmax=50.
xstep=(xmax-xmin)/dble(npoints)
write(*,*) "Computation time comparison between bsjn and besrj"
write(*,*) "bsjn is faster when computing J_n for only one value of n"
write(*,*) "besrj is faster when computing J_n for n=0 to n"
call cpu_time(t1)
do it=1,iter
do i=1,npoints
x=xmin+i*xstep
do nn=0,n
bes=bsjn(nn,x)
end do
end do
end do
call cpu_time(t2)
write (*,'("Calculating "(I10)" values of J_n for n=0 to "(I3)" with bsjn :")') iter*npoints,n
write(*,*) t2-t1
call cpu_time(t1)
do it=1,iter
do i=1,npoints
x=xmin+i*xstep
bes=bsjn(n,x)
end do
end do
call cpu_time(t2)
write (*,'("Calculating "(I10)" values of J_n for n="(I3)" with bsjn :")') iter*npoints,n
write(*,*) t2-t1
! Calcultate J_n(x) on 200 points for n=0 to 50 with besrj
! do it iter times to have a sufficient time value
call cpu_time(t1)
do it=1,iter
do i=1,npoints
x=xmin+i*xstep
call besrj(x,n+1,b)
end do
end do
call cpu_time(t2)
write (*,'("Calculating "(I10)" values of J_n for n=0 to "(I3)" with besrj :")') iter*npoints,n
write(*,*) t2-t1
end program bestime