当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.exp方法代码示例

本文整理汇总了Java中edu.jhu.prim.util.math.FastMath.exp方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.exp方法的具体用法?Java FastMath.exp怎么用?Java FastMath.exp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.jhu.prim.util.math.FastMath的用法示例。


在下文中一共展示了FastMath.exp方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExp

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
public static double[] getExp(double[] logPhi) {
    double[] phi = new double[logPhi.length];
    for (int i=0; i<phi.length; i++) {
        phi[i] = FastMath.exp(logPhi[i]);
    }
    return phi;
}
 
开发者ID:mgormley,项目名称:prim,代码行数:8,代码来源:DoubleArrays.java

示例2: getExp

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
public static float[] getExp(float[] logPhi) {
    float[] phi = new float[logPhi.length];
    for (int i=0; i<phi.length; i++) {
        phi[i] = FastMath.exp(logPhi[i]);
    }
    return phi;
}
 
开发者ID:mgormley,项目名称:prim,代码行数:8,代码来源:FloatArrays.java

示例3: exp

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
public static void exp(double[] phi) {
    for (int i=0; i<phi.length; i++) {
        phi[i] = FastMath.exp(phi[i]);
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:6,代码来源:DoubleArrays.java

示例4: exp

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
public static void exp(float[] phi) {
    for (int i=0; i<phi.length; i++) {
        phi[i] = FastMath.exp(phi[i]);
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:6,代码来源:FloatArrays.java

示例5: toReal

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
@Override
public double toReal(double nonReal) {
    return FastMath.exp(nonReal);
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:5,代码来源:LogSemiring.java

示例6: exp

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
@Override
public double exp(double x) {
    return FastMath.exp(x);
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:5,代码来源:LogSemiring.java

示例7: fromLogProb

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
@Override
public double fromLogProb(double logProb) {
    return FastMath.exp(logProb);
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:5,代码来源:RealAlgebra.java

示例8: toReal

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
/** Converts a compacted number to its real value. */
@Override
public double toReal(double x) {
    double unsignedReal = FastMath.exp(natlog(x));
    return (sign(x) == POSITIVE) ? unsignedReal : -unsignedReal;
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:7,代码来源:LogSignAlgebra.java

示例9: helpTestInsideFirstOrderExpectSingleRoot

import edu.jhu.prim.util.math.FastMath; //导入方法依赖的package包/类
private void helpTestInsideFirstOrderExpectSingleRoot(Algebra s) {
    double[] root = new double[] {1, 2, 3}; 
    double[][] child = new double[][]{ {0, 4, 5}, {6, 0, 7}, {8, 9, 0} };
    
    DoubleArrays.log(root);
    DoubleArrays.log(child);
    
    Pair<O1DpHypergraph, Scores> pair = HyperDepParser.insideSingleRootEntropyFoe(root,  child, s);
    O1DpHypergraph graph = pair.get1();
    Scores scores = pair.get2();
    // Fill with dummy outside scores.
    scores.alpha = new double[scores.beta.length];
    DepIoChart chart = HyperDepParser.getDepIoChart(graph, scores);
    
    // Check inside scores. (These LogInsideScore checks are mostly unnecessary.)
    assertEquals(7, s.toReal(chart.getLogInsideScore(1, 2)), 1e-13);
    assertEquals(9, s.toReal(chart.getLogInsideScore(2, 1)), 1e-13);
    assertEquals(45+20, s.toReal(chart.getLogInsideScore(0, 2)), 1e-10);
    assertEquals(45+28+20, s.toReal(chart.getLogInsideScore(-1, 0)), 1e-10);
    assertEquals(84, s.toReal(chart.getLogInsideScore(-1, 1)), 1e-13);
    assertEquals(8*9+8*4, s.toReal(chart.getLogInsideScore(2, 0)), 1e-10);
    assertEquals(162+216+96, s.toReal(chart.getLogInsideScore(-1, 2)), 1e-3);
    
    // Check partition function.
    int rt = graph.getRoot().getId();
    double Z = s.toReal(scores.beta[rt]);        
    assertEquals(45+28+20+84+162+216+96, Z, 1e-10);

    // Check expected log of derivations.
    double[] trees = new double[] {45, 28, 20, 84, 162, 216, 96};
    double expectedRbar = 0;
    for (int t=0; t<trees.length; t++) {
        expectedRbar += trees[t] * FastMath.log(trees[t]);
    }
    double rBar = scores.betaFoe[rt];
    assertEquals(expectedRbar, s.toReal(rBar), 1e-10);
    
    double logZ = FastMath.log(Z);
    double entropy = logZ - FastMath.exp(FastMath.log(s.toReal(rBar)) - logZ);
    assertEquals(1.685678668864755, entropy, 1e-10);
}
 
开发者ID:mgormley,项目名称:pacaya,代码行数:42,代码来源:HyperDepParserTest.java


注:本文中的edu.jhu.prim.util.math.FastMath.exp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。