public static double logpdf(double x,double k,double theta){
  if (x < 0) {
    return Double.NEGATIVE_INFINITY;
  }
  if (x == 0) {
    return (k == 1.0) ? Math.log(theta) : Double.NEGATIVE_INFINITY;
  }
  if (k == 1.0) {
    return Math.log(theta) - x * theta;
  }
  final double xt=x * theta;
  return (xt == Double.POSITIVE_INFINITY) ? Double.NEGATIVE_INFINITY : Math.log(theta) + (k - 1.0) * Math.log(xt) - xt - logGamma(k);
}

public static double logpdf ( double x , double k , double theta ) { if ( x < 0 ) { return Double . NEGATIVE_INFINITY ; } if ( x == 0 ) { return ( k == 1.0 ) ? Math . log ( theta ) : Double . NEGATIVE_INFINITY ; } if ( k == 1.0 ) { return Math . log ( theta ) - x * theta ; } final double xt = x * theta ; return ( xt == Double . POSITIVE_INFINITY ) ? Double . NEGATIVE_INFINITY : Math . log ( theta ) + ( k - 1.0 ) * Math . log ( xt ) - xt - logGamma ( k ) ; }
gamma distribution pdf ( with 0 . 0 for x & lt ; 0 )
