Blame view

fvn_test/test_bestime.f90 2.35 KB
c26ba8e72   wdaniau   Added a timing te...
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
  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
8ba5c9c78   wdaniau   1) Updated docume...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  write(*,*)
  write(*,*)
  write(*,*)
  write(*,*) "Computation time comparison between bsin and besri"
  write(*,*) "bsin is faster when computing I_n for only one value of n"
  write(*,*) "besri is faster when computing I_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=bsin(nn,x)
        end do
    end do
  end do
  call cpu_time(t2)
  write (*,'("Calculating "(I10)" values of I_n for n=0 to "(I3)" with bsin :")') iter*npoints,n
  write(*,*) t2-t1
  
  call cpu_time(t1)
  do it=1,iter 
    do i=1,npoints
        x=xmin+i*xstep
          bes=bsin(n,x)
    end do
  end do
  call cpu_time(t2)
  write (*,'("Calculating "(I10)" values of I_n for n="(I3)" with bsin :")') 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 besri(x,n+1,b)
    end do
  end do
  call cpu_time(t2)
  write (*,'("Calculating "(I10)" values of I_n for n=0 to "(I3)" with besri :")') iter*npoints,n
  write(*,*) t2-t1
c26ba8e72   wdaniau   Added a timing te...
101
102
103
  
  
  end program bestime