List of usage examples for org.apache.commons.math.special Beta logBeta
public static double logBeta(double a, double b)
From source file:geogebra.util.MyMath.java
final public static double beta(double a, double b) { return Math.exp(Beta.logBeta(a, b)); }
From source file:dr.inference.model.IndianBuffetProcessPrior.java
private double calculateLogLikelihood() { int sum;/*from w ww. j ava 2 s .c o m*/ if (!dataKnown) { bottom = 1; boolean[] isExplored = new boolean[data.getColumnDimension()]; containsNonZeroElements = new boolean[data.getColumnDimension()]; rowCount = new int[data.getColumnDimension()]; boolean same; for (int i = 0; i < data.getColumnDimension(); i++) { sum = 1; if (!isExplored[i]) { for (int j = i + 1; j < data.getColumnDimension(); j++) { same = true; if (!isExplored[j]) { for (int k = 0; k < data.getRowDimension(); k++) { if (Math.abs(data.getParameterValue(k, i)) != Math .abs(data.getParameterValue(k, j))) same = false; // if (data.getParameterValue(k, j) != 0) { // containsNonZeroElements[j] = true; // } // rowCount[j]+=data.getParameterValue(k,j); } } if (same && containsNonZeroElements[j]) { isExplored[j] = true; sum += 1; } else if (!containsNonZeroElements[j]) { isExplored[j] = true; } } } bottom *= factorial(sum); } } if (!dataKnown || !betaKnown) { sum2 = 0; KPlus = 0; for (int i = 0; i < data.getColumnDimension(); i++) { if (containsNonZeroElements[i]) { KPlus++; sum2 += Beta.logBeta(rowCount[i], data.getRowDimension() + beta.getParameterValue(0) - rowCount[i]); } } } double p1 = KPlus * Math.log(alpha.getParameterValue(0) * beta.getParameterValue(0) / bottom); double p2 = -alpha.getParameterValue(0) * H(); double p3 = sum2; betaKnown = true; dataKnown = true; return p1 + p2 + p3; }
From source file:org.renjin.MathExt.java
public static double beta(double a, double b) { return (Math.exp(Beta.logBeta(a, b))); }
From source file:org.renjin.MathExt.java
public static double lbeta(double a, double b) { return (Beta.logBeta(a, b)); }
From source file:org.renjin.primitives.MathExt.java
@Internal @Deferrable//from ww w .ja va 2 s .c om @DataParallel public static double beta(double a, double b) { return (Math.exp(Beta.logBeta(a, b))); }
From source file:org.renjin.primitives.MathExt.java
@Internal @Deferrable @DataParallel public static double lbeta(double a, double b) { return (Beta.logBeta(a, b)); }
From source file:r.base.MathExt.java
@Primitive public static double beta(@Recycle double a, @Recycle double b) { return (Math.exp(Beta.logBeta(a, b))); }
From source file:r.base.MathExt.java
@Primitive public static double lbeta(@Recycle double a, @Recycle double b) { return (Beta.logBeta(a, b)); }