本文整理汇总了Java中cern.jet.math.Arithmetic.logFactorial方法的典型用法代码示例。如果您正苦于以下问题:Java Arithmetic.logFactorial方法的具体用法?Java Arithmetic.logFactorial怎么用?Java Arithmetic.logFactorial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cern.jet.math.Arithmetic
的用法示例。
在下文中一共展示了Arithmetic.logFactorial方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computePValue
import cern.jet.math.Arithmetic; //导入方法依赖的package包/类
private static double computePValue(int[][] table) {
int[] rowSums = {sumRow(table, 0), sumRow(table, 1)};
int[] colSums = {sumColumn(table, 0), sumColumn(table, 1)};
int N = rowSums[0] + rowSums[1];
// calculate in log space so we don't die with high numbers
double pCutoff = Arithmetic.logFactorial(rowSums[0])
+ Arithmetic.logFactorial(rowSums[1])
+ Arithmetic.logFactorial(colSums[0])
+ Arithmetic.logFactorial(colSums[1])
- Arithmetic.logFactorial(table[0][0])
- Arithmetic.logFactorial(table[0][1])
- Arithmetic.logFactorial(table[1][0])
- Arithmetic.logFactorial(table[1][1])
- Arithmetic.logFactorial(N);
return Math.exp(pCutoff);
}
示例2: computePValue
import cern.jet.math.Arithmetic; //导入方法依赖的package包/类
private static double computePValue(int[][] table) {
int[] rowSums = { sumRow(table, 0), sumRow(table, 1) };
int[] colSums = { sumColumn(table, 0), sumColumn(table, 1) };
int N = rowSums[0] + rowSums[1];
// calculate in log space so we don't die with high numbers
double pCutoff = Arithmetic.logFactorial(rowSums[0])
+ Arithmetic.logFactorial(rowSums[1])
+ Arithmetic.logFactorial(colSums[0])
+ Arithmetic.logFactorial(colSums[1])
- Arithmetic.logFactorial(table[0][0])
- Arithmetic.logFactorial(table[0][1])
- Arithmetic.logFactorial(table[1][0])
- Arithmetic.logFactorial(table[1][1])
- Arithmetic.logFactorial(N);
return Math.exp(pCutoff);
}
示例3: computePValue
import cern.jet.math.Arithmetic; //导入方法依赖的package包/类
public static double computePValue(int[][] table) {
int[] rowSums = { sumRow(table, 0), sumRow(table, 1) };
int[] colSums = { sumColumn(table, 0), sumColumn(table, 1) };
int N = rowSums[0] + rowSums[1];
// calculate in log space for better precision
double pCutoff = Arithmetic.logFactorial(rowSums[0])
+ Arithmetic.logFactorial(rowSums[1])
+ Arithmetic.logFactorial(colSums[0])
+ Arithmetic.logFactorial(colSums[1])
- Arithmetic.logFactorial(table[0][0])
- Arithmetic.logFactorial(table[0][1])
- Arithmetic.logFactorial(table[1][0])
- Arithmetic.logFactorial(table[1][1])
- Arithmetic.logFactorial(N);
return Math.exp(pCutoff);
}
示例4: setNandP
import cern.jet.math.Arithmetic; //导入方法依赖的package包/类
/**
* Sets the parameters number of trials and the probability of success.
* @param n the number of trials
* @param p the probability of success.
* @throws IllegalArgumentException if <tt>n*Math.min(p,1-p) <= 0.0</tt>
*/
public void setNandP(int n, double p) {
if (n*Math.min(p,1-p) <= 0.0) throw new IllegalArgumentException();
this.n = n;
this.p = p;
this.log_p = Math.log(p);
this.log_q = Math.log(1.0-p);
this.log_n = Arithmetic.logFactorial(n);
}
示例5: fc_lnpk
import cern.jet.math.Arithmetic; //导入方法依赖的package包/类
private static double fc_lnpk(int k, int N_Mn, int M, int n) {
return(Arithmetic.logFactorial(k) + Arithmetic.logFactorial(M - k) + Arithmetic.logFactorial(n - k) + Arithmetic.logFactorial(N_Mn + k));
}
示例6: poissonLogPDF
import cern.jet.math.Arithmetic; //导入方法依赖的package包/类
/**
* Computes the log-space PDF of the Poisson distribution with the
* specified mean. Code lifted from the COLT Poisson class so that it can
* be implemented as a static method instead of having to instantiate a
* COLT Poisson object
* @param mean
* @param k
* @return
*/
public static double poissonLogPDF(double mean, int k) {
return k * Math.log(mean) - Arithmetic.logFactorial(k) - mean;
}