The Elk Code
fsmooth.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2005 J. K. Dewhurst and S. Sharma.
3 ! This file is distributed under the terms of the GNU Lesser General Public
4 ! License. See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: fsmooth
8 ! !INTERFACE:
9 pure subroutine fsmooth(m,n,f)
10 ! !INPUT/OUTPUT PARAMETERS:
11 ! m : number of 3-point running averages to perform (in,integer)
12 ! n : number of point (in,integer)
13 ! f : function array (inout,real(n))
14 ! !DESCRIPTION:
15 ! Removes numerical noise from a function by performing $m$ successive
16 ! 3-point running averages on the data. The endpoints are kept fixed.
17 !
18 ! !REVISION HISTORY:
19 ! Created December 2005 (JKD)
20 !EOP
21 !BOC
22 implicit none
23 ! arguments
24 integer, intent(in) :: m,n
25 real(8), intent(inout) :: f(n)
26 ! local variables
27 integer i,j
28 real(8) f1,f2,f3
29 do i=1,m
30  f1=f(1); f2=f(2)
31  do j=2,n-1
32  f3=f(j+1)
33  f(j)=0.3333333333333333333d0*(f1+f2+f3)
34  f1=f2; f2=f3
35  end do
36 end do
37 end subroutine
38 !EOC
39 
pure subroutine fsmooth(m, n, f)
Definition: fsmooth.f90:10