anchor.diff: -! MD5 of template: 19a13172cee8d4d396bd8e3a39c6cb08
  +! MD5 of template: de1baa4b78ae2b9da8efc3705a89c946
   ! Array related routines (Integration, Interpolation, etc.)
   ! Thomas Robitaille (c) 2009
   
  
positive.code:        end function f_integral
      end interface
      do i=1,size(xx)
      if(i==1) then
      xmin = xx(1)
      else
      xmin = f_average(xx(i-1), xx(i))
      end if
      if(i==size(xx)) then
      xmax = xx(size(xx))
      else
      xmax = f_average(xx(i), xx(i+1))
      end if
      yy(i) = f_integral(x, y, xmin, xmax) / (xmax - xmin)
      end do
      end subroutine rebin_general_sp
  
    integer function locate_sp(xx,x)
      ! Locate a value in a sorted array
  
negative.code: 
    end function interp2d_sp
  
    real(sp) function average_lin_sp(a,b)
      implicit none
      real(sp),intent(in) :: a,b
      average_lin_sp = 0.5_sp * (a + b)
    end function average_lin_sp
  
    real(sp) function average_log_sp(a,b)
      implicit none
      real(sp),intent(in) :: a,b
      average_log_sp = sqrt(a*b)
    end function average_log_sp
  
    subroutine rebin_sp(x, y, xx, yy)
      real(sp),intent(in) :: x(:), y(:), xx(:)
      real(sp),intent(out) :: yy(:)
      call rebin_general_sp(x, y, xx, yy, average_lin_sp, integral_subset_sp)
    end subroutine rebin_sp
  
    subroutine rebin_linlog_sp(x, y, xx, yy)
      real(sp),intent(in) :: x(:), y(:), xx(:)
      real(sp),intent(out) :: yy(:)
      call rebin_general_sp(x, y, xx, yy, average_lin_sp, integral_linlog_subset_sp)
    end subroutine rebin_linlog_sp
  
    subroutine rebin_loglin_sp(x, y, xx, yy)
      real(sp),intent(in) :: x(:), y(:), xx(:)
      real(sp),intent(out) :: yy(:)
      call rebin_general_sp(x, y, xx, yy, average_log_sp, integral_loglin_subset_sp)
    end subroutine rebin_loglin_sp
  
    subroutine rebin_loglog_sp(x, y, xx, yy)
      real(sp),intent(in) :: x(:), y(:), xx(:)
      real(sp),intent(out) :: yy(:)
      call rebin_general_sp(x, y, xx, yy, average_log_sp, integral_loglog_subset_sp)
    end subroutine rebin_loglog_sp
  
    subroutine rebin_general_sp(x, y, xx, yy, f_average, f_integral)
      implicit none
      real(sp),intent(in) :: x(:), y(:), xx(:)
      real(sp),intent(out) :: yy(:)
      integer :: i
      real(sp) :: xmin, xmax
      interface
         real(sp) function f_average(a,b)
           import :: sp
           implicit none
  