C      program main
C      double precision ker,s,t
C      write (*,*) "ok"
C      s =  0.175720214843750
C      t =   0.534515380859375 
C      ker = genKer(s,t)
C      write(*,*) "ker at (s,t)", s,t,ker
C      end

C     Note that s1 and t1 should be within [0,1] unit
      function genKer(s1,t1)
      double precision genKer
      double precision s1,t1
      double precision k1s,k1t,k2s,k2t,st,k1st,k4st
      
      k1s = s1 - 0.5
      k1t = t1 - 0.5
      
      k2s = (k1s**2 - 1/12)/2
      k2t = (k1t**2 - 1/12)/2
      
      st = abs(s1-t1)
      k1st = st - 0.5
      k4st = (k1st**4 - k1st**2/2 + 7/240)/24

      genKer = k1s*k1t + k2s*k2t - k4st
      end


