public class org.apache.commons.math.special.Gamma extends java.lang.Object
{
public static final double GAMMA;
public static final double LANCZOS_G;
private static final double DEFAULT_EPSILON;
private static final double[] LANCZOS;
private static final double HALF_LOG_2_PI;
private static final double SQRT_TWO_PI;
private static final double C_LIMIT;
private static final double S_LIMIT;
private static final double INV_GAMMA1P_M1_A0;
private static final double INV_GAMMA1P_M1_A1;
private static final double INV_GAMMA1P_M1_B1;
private static final double INV_GAMMA1P_M1_B2;
private static final double INV_GAMMA1P_M1_B3;
private static final double INV_GAMMA1P_M1_B4;
private static final double INV_GAMMA1P_M1_B5;
private static final double INV_GAMMA1P_M1_B6;
private static final double INV_GAMMA1P_M1_B7;
private static final double INV_GAMMA1P_M1_B8;
private static final double INV_GAMMA1P_M1_P0;
private static final double INV_GAMMA1P_M1_P1;
private static final double INV_GAMMA1P_M1_P2;
private static final double INV_GAMMA1P_M1_P3;
private static final double INV_GAMMA1P_M1_P4;
private static final double INV_GAMMA1P_M1_P5;
private static final double INV_GAMMA1P_M1_P6;
private static final double INV_GAMMA1P_M1_Q1;
private static final double INV_GAMMA1P_M1_Q2;
private static final double INV_GAMMA1P_M1_Q3;
private static final double INV_GAMMA1P_M1_Q4;
private static final double INV_GAMMA1P_M1_C;
private static final double INV_GAMMA1P_M1_C0;
private static final double INV_GAMMA1P_M1_C1;
private static final double INV_GAMMA1P_M1_C2;
private static final double INV_GAMMA1P_M1_C3;
private static final double INV_GAMMA1P_M1_C4;
private static final double INV_GAMMA1P_M1_C5;
private static final double INV_GAMMA1P_M1_C6;
private static final double INV_GAMMA1P_M1_C7;
private static final double INV_GAMMA1P_M1_C8;
private static final double INV_GAMMA1P_M1_C9;
private static final double INV_GAMMA1P_M1_C10;
private static final double INV_GAMMA1P_M1_C11;
private static final double INV_GAMMA1P_M1_C12;
private static final double INV_GAMMA1P_M1_C13;
private void <init>()
{
org.apache.commons.math.special.Gamma v;
v := @this: org.apache.commons.math.special.Gamma;
specialinvoke v.<java.lang.Object: void <init>()>();
return;
}
public static double logGamma(double)
{
byte v, v, v, v;
boolean v;
int v, v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
v := @parameter: double;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v != 0 goto label;
v = v cmpg 0.0;
if v > 0 goto label;
label:
v = #NaN;
goto label;
label:
v = v cmpg 0.5;
if v >= 0 goto label;
v = staticinvoke <org.apache.commons.math.special.Gamma: double logGamma1p(double)>(v);
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = v - v;
return v;
label:
v = v cmpg 2.5;
if v > 0 goto label;
v = v - 0.5;
v = v - 0.5;
v = staticinvoke <org.apache.commons.math.special.Gamma: double logGamma1p(double)>(v);
return v;
label:
v = v cmpg 8.0;
if v > 0 goto label;
v = v - 1.5;
v = staticinvoke <org.apache.commons.math.util.FastMath: double floor(double)>(v);
v = 1.0;
v = 1;
label:
if v > v goto label;
v = v - v;
v = v * v;
v = v + 1;
goto label;
label:
v = v + 1;
v = v - v;
v = staticinvoke <org.apache.commons.math.special.Gamma: double logGamma1p(double)>(v);
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = v + v;
return v;
label:
v = staticinvoke <org.apache.commons.math.special.Gamma: double lanczos(double)>(v);
v = v + 4.7421875;
v = v + 0.5;
v = v + 0.5;
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = v * v;
v = v - v;
v = <org.apache.commons.math.special.Gamma: double HALF_LOG_2_PI>;
v = v + v;
v = v / v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = v + v;
label:
return v;
}
public static double regularizedGammaP(double, double)
{
double v, v, v;
v := @parameter: double;
v := @parameter: double;
v = staticinvoke <org.apache.commons.math.special.Gamma: double regularizedGammaP(double,double,double,int)>(v, v, 1.0E-14, 2147483647);
return v;
}
public static double regularizedGammaP(double, double, double, int)
{
java.lang.Integer v;
byte v, v, v, v, v, v, v, v;
boolean v, v, v;
int v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
org.apache.commons.math.exception.MaxCountExceededException v;
v := @parameter: double;
v := @parameter: double;
v := @parameter: double;
v := @parameter: int;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v != 0 goto label;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v != 0 goto label;
v = v cmpg 0.0;
if v <= 0 goto label;
v = v cmpg 0.0;
if v >= 0 goto label;
label:
v = #NaN;
goto label;
label:
v = v cmpl 0.0;
if v != 0 goto label;
v = 0.0;
goto label;
label:
v = v + 1.0;
v = v cmpl v;
if v < 0 goto label;
v = staticinvoke <org.apache.commons.math.special.Gamma: double regularizedGammaQ(double,double,double,int)>(v, v, v, v);
v = 1.0 - v;
goto label;
label:
v = 0.0;
v = 1.0 / v;
v = v;
label:
v = v / v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double abs(double)>(v);
v = v cmpl v;
if v <= 0 goto label;
v = v cmpg v;
if v >= 0 goto label;
v = v cmpg #Infinity;
if v >= 0 goto label;
v = v + 1.0;
v = v + v;
v = v / v;
v = v * v;
v = v + v;
goto label;
label:
v = v cmpl v;
if v < 0 goto label;
v = new org.apache.commons.math.exception.MaxCountExceededException;
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(v);
specialinvoke v.<org.apache.commons.math.exception.MaxCountExceededException: void <init>(java.lang.Number)>(v);
throw v;
label:
v = staticinvoke <java.lang.Double: boolean isInfinite(double)>(v);
if v == 0 goto label;
v = 1.0;
goto label;
label:
v = neg v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = v * v;
v = v + v;
v = staticinvoke <org.apache.commons.math.special.Gamma: double logGamma(double)>(v);
v = v - v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double exp(double)>(v);
v = v * v;
label:
return v;
}
public static double regularizedGammaQ(double, double)
{
double v, v, v;
v := @parameter: double;
v := @parameter: double;
v = staticinvoke <org.apache.commons.math.special.Gamma: double regularizedGammaQ(double,double,double,int)>(v, v, 1.0E-14, 2147483647);
return v;
}
public static double regularizedGammaQ(double, double, double, int)
{
org.apache.commons.math.special.Gamma$1 v;
byte v, v, v, v;
int v;
boolean v, v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
v := @parameter: double;
v := @parameter: double;
v := @parameter: double;
v := @parameter: int;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v != 0 goto label;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v != 0 goto label;
v = v cmpg 0.0;
if v <= 0 goto label;
v = v cmpg 0.0;
if v >= 0 goto label;
label:
v = #NaN;
goto label;
label:
v = v cmpl 0.0;
if v != 0 goto label;
v = 1.0;
goto label;
label:
v = v + 1.0;
v = v cmpg v;
if v >= 0 goto label;
v = staticinvoke <org.apache.commons.math.special.Gamma: double regularizedGammaP(double,double,double,int)>(v, v, v, v);
v = 1.0 - v;
goto label;
label:
v = new org.apache.commons.math.special.Gamma$1;
specialinvoke v.<org.apache.commons.math.special.Gamma$1: void <init>(double)>(v);
v = virtualinvoke v.<org.apache.commons.math.util.ContinuedFraction: double evaluate(double,double,int)>(v, v, v);
v = 1.0 / v;
v = neg v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = v * v;
v = v + v;
v = staticinvoke <org.apache.commons.math.special.Gamma: double logGamma(double)>(v);
v = v - v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double exp(double)>(v);
v = v * v;
label:
return v;
}
public static double digamma(double)
{
byte v, v, v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
v := @parameter: double;
v = v cmpl 0.0;
if v <= 0 goto label;
v = v cmpg 1.0E-5;
if v > 0 goto label;
v = 1.0 / v;
v = -0.5772156649015329 - v;
return v;
label:
v = v cmpl 49.0;
if v < 0 goto label;
v = v * v;
v = 1.0 / v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(v);
v = 0.5 / v;
v = v - v;
v = v / 252.0;
v = 0.008333333333333333 - v;
v = v * v;
v = 0.08333333333333333 + v;
v = v * v;
v = v - v;
return v;
label:
v = v + 1.0;
v = staticinvoke <org.apache.commons.math.special.Gamma: double digamma(double)>(v);
v = 1.0 / v;
v = v - v;
return v;
}
public static double trigamma(double)
{
byte v, v, v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
v := @parameter: double;
v = v cmpl 0.0;
if v <= 0 goto label;
v = v cmpg 1.0E-5;
if v > 0 goto label;
v = v * v;
v = 1.0 / v;
return v;
label:
v = v cmpl 49.0;
if v < 0 goto label;
v = v * v;
v = 1.0 / v;
v = 1.0 / v;
v = v / 2.0;
v = v + v;
v = v / v;
v = v / 42.0;
v = 0.03333333333333333 + v;
v = v * v;
v = 0.16666666666666666 - v;
v = v * v;
v = v + v;
return v;
label:
v = v + 1.0;
v = staticinvoke <org.apache.commons.math.special.Gamma: double trigamma(double)>(v);
v = v * v;
v = 1.0 / v;
v = v + v;
return v;
}
public static double lanczos(double)
{
double[] v, v, v;
int v, v;
double v, v, v, v, v, v, v;
v := @parameter: double;
v = 0.0;
v = <org.apache.commons.math.special.Gamma: double[] LANCZOS>;
v = lengthof v;
v = v - 1;
label:
if v <= 0 goto label;
v = <org.apache.commons.math.special.Gamma: double[] LANCZOS>;
v = v[v];
v = v + v;
v = v / v;
v = v + v;
v = v - 1;
goto label;
label:
v = <org.apache.commons.math.special.Gamma: double[] LANCZOS>;
v = v[0];
v = v + v;
return v;
}
public static double invGamma1pm1(double)
{
byte v, v, v, v, v, v;
java.lang.Double v, v, v, v;
org.apache.commons.math.exception.NumberIsTooSmallException v;
org.apache.commons.math.exception.NumberIsTooLargeException v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
v := @parameter: double;
v = v cmpg -0.5;
if v >= 0 goto label;
v = new org.apache.commons.math.exception.NumberIsTooSmallException;
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(v);
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(-0.5);
specialinvoke v.<org.apache.commons.math.exception.NumberIsTooSmallException: void <init>(java.lang.Number,java.lang.Number,boolean)>(v, v, 1);
throw v;
label:
v = v cmpl 1.5;
if v <= 0 goto label;
v = new org.apache.commons.math.exception.NumberIsTooLargeException;
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(v);
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(1.5);
specialinvoke v.<org.apache.commons.math.exception.NumberIsTooLargeException: void <init>(java.lang.Number,java.lang.Number,boolean)>(v, v, 1);
throw v;
label:
v = v cmpg 0.5;
if v > 0 goto label;
v = v;
goto label;
label:
v = v - 0.5;
v = v - 0.5;
label:
v = v cmpg 0.0;
if v >= 0 goto label;
v = v * 6.247308301164655E-9;
v = 6.116095104481416E-9 + v;
v = v * 1.9575583661463974E-10;
v = -6.077618957228252E-8 + v;
v = v * v;
v = 9.926418406727737E-7 + v;
v = v * v;
v = -6.4304548177935305E-6 + v;
v = v * v;
v = -8.514194324403149E-6 + v;
v = v * v;
v = 4.939449793824468E-4 + v;
v = v * v;
v = 0.026620534842894922 + v;
v = v * v;
v = 0.203610414066807 + v;
v = v * v;
v = 1.0 + v;
v = v / v;
v = v * v;
v = -2.056338416977607E-7 + v;
v = v * v;
v = 1.133027231981696E-6 + v;
v = v * v;
v = -1.2504934821426706E-6 + v;
v = v * v;
v = -2.013485478078824E-5 + v;
v = v * v;
v = 1.280502823881162E-4 + v;
v = v * v;
v = -2.1524167411495098E-4 + v;
v = v * v;
v = -0.0011651675918590652 + v;
v = v * v;
v = 0.0072189432466631 + v;
v = v * v;
v = -0.009621971527876973 + v;
v = v * v;
v = -0.04219773455554433 + v;
v = v * v;
v = 0.16653861138229148 + v;
v = v * v;
v = -0.04200263503409524 + v;
v = v * v;
v = -0.6558780715202539 + v;
v = v * v;
v = -0.42278433509846713 + v;
v = v cmpl 0.5;
if v <= 0 goto label;
v = v * v;
v = v / v;
goto label;
label:
v = v + 0.5;
v = v + 0.5;
v = v * v;
goto label;
label:
v = v * 4.343529937408594E-15;
v = -1.2494415722763663E-13 + v;
v = v * v;
v = 1.5728330277104463E-12 + v;
v = v * v;
v = 4.686843322948848E-11 + v;
v = v * v;
v = 6.820161668496171E-10 + v;
v = v * v;
v = 6.8716741130671986E-9 + v;
v = v * v;
v = 6.116095104481416E-9 + v;
v = v * 2.6923694661863613E-4;
v = 0.004956830093825887 + v;
v = v * v;
v = 0.054642130860422966 + v;
v = v * v;
v = 0.3056961078365221 + v;
v = v * v;
v = 1.0 + v;
v = v / v;
v = v * v;
v = -2.056338416977607E-7 + v;
v = v * v;
v = 1.133027231981696E-6 + v;
v = v * v;
v = -1.2504934821426706E-6 + v;
v = v * v;
v = -2.013485478078824E-5 + v;
v = v * v;
v = 1.280502823881162E-4 + v;
v = v * v;
v = -2.1524167411495098E-4 + v;
v = v * v;
v = -0.0011651675918590652 + v;
v = v * v;
v = 0.0072189432466631 + v;
v = v * v;
v = -0.009621971527876973 + v;
v = v * v;
v = -0.04219773455554433 + v;
v = v * v;
v = 0.16653861138229148 + v;
v = v * v;
v = -0.04200263503409524 + v;
v = v * v;
v = -0.6558780715202539 + v;
v = v * v;
v = 0.5772156649015329 + v;
v = v cmpl 0.5;
if v <= 0 goto label;
v = v / v;
v = v - 0.5;
v = v - 0.5;
v = v * v;
goto label;
label:
v = v * v;
label:
return v;
}
public static double logGamma1p(double) throws org.apache.commons.math.exception.NumberIsTooSmallException, org.apache.commons.math.exception.NumberIsTooLargeException
{
java.lang.Double v, v, v, v;
org.apache.commons.math.exception.NumberIsTooLargeException v;
org.apache.commons.math.exception.NumberIsTooSmallException v;
byte v, v;
double v, v, v, v;
v := @parameter: double;
v = v cmpg -0.5;
if v >= 0 goto label;
v = new org.apache.commons.math.exception.NumberIsTooSmallException;
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(v);
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(-0.5);
specialinvoke v.<org.apache.commons.math.exception.NumberIsTooSmallException: void <init>(java.lang.Number,java.lang.Number,boolean)>(v, v, 1);
throw v;
label:
v = v cmpl 1.5;
if v <= 0 goto label;
v = new org.apache.commons.math.exception.NumberIsTooLargeException;
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(v);
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(1.5);
specialinvoke v.<org.apache.commons.math.exception.NumberIsTooLargeException: void <init>(java.lang.Number,java.lang.Number,boolean)>(v, v, 1);
throw v;
label:
v = staticinvoke <org.apache.commons.math.special.Gamma: double invGamma1pm1(double)>(v);
v = staticinvoke <org.apache.commons.math.util.FastMath: double log1p(double)>(v);
v = neg v;
return v;
}
public static double gamma(double)
{
byte v, v, v, v, v, v, v;
double v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v;
v := @parameter: double;
v = staticinvoke <org.apache.commons.math.util.FastMath: double rint(double)>(v);
v = v cmpl v;
if v != 0 goto label;
v = v cmpg 0.0;
if v > 0 goto label;
return #NaN;
label:
v = staticinvoke <org.apache.commons.math.util.FastMath: double abs(double)>(v);
v = v cmpg 20.0;
if v > 0 goto label;
v = v cmpl 1.0;
if v < 0 goto label;
v = 1.0;
v = v;
label:
v = v cmpl 2.5;
if v <= 0 goto label;
v = v - 1.0;
v = v * v;
goto label;
label:
v = v - 1.0;
v = staticinvoke <org.apache.commons.math.special.Gamma: double invGamma1pm1(double)>(v);
v = 1.0 + v;
v = v / v;
goto label;
label:
v = v;
v = v;
label:
v = v cmpg -0.5;
if v >= 0 goto label;
v = v + 1.0;
v = v * v;
goto label;
label:
v = staticinvoke <org.apache.commons.math.special.Gamma: double invGamma1pm1(double)>(v);
v = 1.0 + v;
v = v * v;
v = 1.0 / v;
goto label;
label:
v = v + 4.7421875;
v = v + 0.5;
v = 2.5066282746310007 / v;
v = v + 0.5;
v = staticinvoke <org.apache.commons.math.util.FastMath: double pow(double,double)>(v, v);
v = v * v;
v = neg v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double exp(double)>(v);
v = v * v;
v = staticinvoke <org.apache.commons.math.special.Gamma: double lanczos(double)>(v);
v = v * v;
v = v cmpl 0.0;
if v <= 0 goto label;
v = v;
goto label;
label:
v = 3.141592653589793 * v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double sin(double)>(v);
v = v * v;
v = v * v;
v = -3.141592653589793 / v;
label:
return v;
}
static void <clinit>()
{
double[] v;
double v, v;
v = newarray (double)[15];
v[0] = 0.9999999999999971;
v[1] = 57.15623566586292;
v[2] = -59.59796035547549;
v[3] = 14.136097974741746;
v[4] = -0.4919138160976202;
v[5] = 3.399464998481189E-5;
v[6] = 4.652362892704858E-5;
v[7] = -9.837447530487956E-5;
v[8] = 1.580887032249125E-4;
v[9] = -2.1026444172410488E-4;
v[10] = 2.1743961811521265E-4;
v[11] = -1.643181065367639E-4;
v[12] = 8.441822398385275E-5;
v[13] = -2.6190838401581408E-5;
v[14] = 3.6899182659531625E-6;
<org.apache.commons.math.special.Gamma: double[] LANCZOS> = v;
v = staticinvoke <org.apache.commons.math.util.FastMath: double log(double)>(6.283185307179586);
v = 0.5 * v;
<org.apache.commons.math.special.Gamma: double HALF_LOG_2_PI> = v;
return;
}
}