c    @(#)shpiro.f	1.2
c
c
c
      subroutine shpiro(g,m,nord)
c
c --- g = portion of a larger array to be filtered
c --- m = length of this array
c --- nord = order of the filter
c
c --- this subroutine calculates the factor to be added to
c --- a field in order to filter it using subroutine filter
c
      dimension g(m)
      mm1=m-1
      mm2=m-2
      do 100 kord=1,nord
        do 10 i=1,mm1
          g(i)=g(i+1)-g(i)
   10   continue
        g(m)=-2.*g(mm1)
        g12=2.*g(1)
        do 20 ii=1,mm2
          i=m-ii
          g(i)=g(i)-g(i-1)
   20   continue
        g(1)=g12
  100 continue
      return
      end
