Generated by TAPENADE

    !        Generated by TAPENADE     (INRIA, Tropics team)
    !  Tapenade 3.4 (r3375) - 10 Feb 2010 15:08
    !
    ! pars(1) = mu_x
    ! pars(2) = mu_y
    ! pars(3) = sigma_x
    ! pars(4) = sigma_y
    ! pars(5) = rho
    SUBROUTINE LOGGAUSSPDF(n, x, y, pars, res)
      IMPLICIT NONE
      REAL*8, PARAMETER :: twopi=6.283185307179586e+00_8
      INTEGER, INTENT(IN) :: n
      REAL*8, DIMENSION(n), INTENT(IN) :: x
      REAL*8, DIMENSION(n), INTENT(IN) :: y
      REAL*8, DIMENSION(5), INTENT(IN) :: pars
      REAL*8, DIMENSION(n), INTENT(OUT) :: res
      REAL*8, DIMENSION(n) :: cen1, cen2
      REAL*8 :: t1, f1, f2, f12
      REAL(8) :: arg1
      REAL :: result1
      REAL*8 :: arg2
      INTRINSIC LOG
      INTRINSIC SQRT
      t1 = -(0.5_8/(1.0_8-pars(5)**2))
      f1 = t1/pars(3)**2
      f2 = t1/pars(4)**2
      f12 = -(2.0*pars(5)*t1/(pars(3)*pars(4)))
      cen1 = x - pars(1)
      cen2 = y - pars(2)
      arg1 = 1.0_8 - pars(5)**2
      result1 = SQRT(arg1)
      arg2 = twopi*pars(3)*pars(4)*result1
      res = -LOG(arg2) + f1*cen1**2 + f2*cen2**2 + f12*cen1*cen2
    END SUBROUTINE LOGGAUSSPDF