Generated by TAPENADE

    !        Generated by TAPENADE     (INRIA, Tropics team)
    !  Tapenade 3.4 (r3375) - 10 Feb 2010 15:08
    !
    SUBROUTINE LGOBFUN(n, x, y, wts, x0, y0, pp, hx, hy, ll)
      IMPLICIT NONE
      INTEGER, INTENT(IN) :: n
      REAL*8, DIMENSION(n), INTENT(IN) :: x
      REAL*8, DIMENSION(n), INTENT(IN) :: y
      REAL*8, DIMENSION(n), INTENT(IN) :: wts
      REAL*8, INTENT(IN) :: x0
      REAL*8, INTENT(IN) :: y0
      REAL*8, DIMENSION(5), INTENT(IN) :: pp
      REAL*8, INTENT(IN) :: hx
      REAL*8, INTENT(IN) :: hy
      REAL*8, INTENT(OUT) :: ll
      REAL*8, DIMENSION(n) :: lgauss
      REAL*8, DIMENSION(5) :: pars2
      REAL*8, DIMENSION(1) :: xtmp, ytmp, restmp
      REAL*8, DIMENSION(5) :: pars
      REAL*8, DIMENSION(n) :: arg1
      REAL*8 :: arg10
      INTRINSIC EXP
      INTRINSIC SUM
      INTRINSIC SQRT
      pars(1:2) = pp(1:2)
      pars(3:4) = EXP(pp(3:4))
      pars(5) = -1.0_8 + 2.0_8*EXP(pp(5))/(1.0_8+EXP(pp(5)))
      CALL LOGGAUSSPDF(n, x, y, pars, lgauss)
      arg1(:) = wts*lgauss
      ll = SUM(arg1(:))/(1.0_8*n)
      pars2(1:2) = pars(1:2)
      arg10 = pars(3)**2 + hx**2
      pars2(3) = SQRT(arg10)
      arg10 = pars(4)**2 + hy**2
      pars2(4) = SQRT(arg10)
      pars2(5) = pars(5)*pars(3)*pars(4)/(pars2(3)*pars2(4))
      xtmp(1) = x0
      ytmp(1) = y0
      CALL LOGGAUSSPDF(1, xtmp, ytmp, pars2, restmp)
      ll = ll - EXP(restmp(1))
    END SUBROUTINE LGOBFUN