本文整理了Java中java.lang.Math.exp()
方法的一些代码示例,展示了Math.exp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Math.exp()
方法的具体详情如下:
包路径:java.lang.Math
类名称:Math
方法名:exp
[英]Returns the closest double approximation of the raising "e" to the power of the argument. The returned result is within 1 ulp (unit in the last place) of the real result.
Special cases:
代码示例来源:origin: hankcs/HanLP
/**
* sigmoid函数
*
* @param value
* @return
*/
public static float sigMoid(float value)
{
return (float) (1d / (1d + Math.exp(-value)));
}
代码示例来源:origin: hankcs/HanLP
private static double toProb(Node n, double Z)
{
return Math.exp(n.alpha + n.beta - n.cost - Z);
}
代码示例来源:origin: hankcs/HanLP
public double prob()
{
return Math.exp(-cost_ - Z_);
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private static float viscousFluid(float x) {
x *= VISCOUS_FLUID_SCALE;
if (x < 1.0f) {
x -= (1.0f - (float)Math.exp(-x));
} else {
float start = 0.36787944117f; // 1/e == exp(-1)
x = 1.0f - (float)Math.exp(1.0f - x);
x = start + x * (1.0f - start);
}
return x;
}
代码示例来源:origin: stanfordnlp/CoreNLP
public static double[] softmax(double[] scales) {
double[] newScales = new double[scales.length];
double sum = 0;
for (int i = 0; i < scales.length; i++) {
newScales[i] = Math.exp(scales[i]);
sum += newScales[i];
}
for (int i = 0; i < scales.length; i++) {
newScales[i] /= sum;
}
return newScales;
}
代码示例来源:origin: apache/incubator-druid
@Override
protected ExprEval eval(double param)
{
return ExprEval.of(Math.exp(param));
}
}
代码示例来源:origin: hankcs/HanLP
@Override
public void unLog()
{
super.unLog();
for (float[][] m : transition_probability2)
{
for (float[] v : m)
{
for (int i = 0; i < v.length; i++)
{
v[i] = (float) Math.exp(v[i]);
}
}
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* Returns the probability for the given labels (indexed using classIndex),
* where the last label corresponds to the label at the specified position.
* For instance if you called prob(5, {1,2,3}) it will return the marginal
* prob that the label at position 3 is 1, the label at position 4 is 2 and
* the label at position 5 is 3.
*/
public double prob(int position, int[] labels) {
return Math.exp(logProb(position, labels));
}
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* returns the probability for the given labels, where the last label
* corresponds to the label at the specified position. For instance if you
* called logProb(5, {"O", "PER", "ORG"}) it will return the marginal prob
* that the label at position 3 is "O", the label at position 4 is "PER" and
* the label at position 5 is "ORG".
*/
public double prob(int position, E[] labels) {
return Math.exp(logProb(position, labels));
}
代码示例来源:origin: stanfordnlp/CoreNLP
public static double poisson(int x, double lambda) {
if (x<0 || lambda<=0.0) throw new RuntimeException("Bad arguments: " + x + " and " + lambda);
double p = (Math.exp(-lambda) * Math.pow(lambda, x)) / factorial(x);
if (Double.isInfinite(p) || p<=0.0) throw new RuntimeException(Math.exp(-lambda) +" "+ Math.pow(lambda, x) + ' ' + factorial(x));
return p;
}
代码示例来源:origin: google/guava
static double randomPositiveDouble() {
return Math.exp(randomDouble(6));
}
}
代码示例来源:origin: prestodb/presto
private static Point tileXYToLatitudeLongitude(int tileX, int tileY, int zoomLevel)
{
long mapSize = mapSize(zoomLevel);
double x = (clip(tileX * TILE_PIXELS, 0, mapSize) / mapSize) - 0.5;
double y = 0.5 - (clip(tileY * TILE_PIXELS, 0, mapSize) / mapSize);
double latitude = 90 - 360 * Math.atan(Math.exp(-y * 2 * Math.PI)) / Math.PI;
double longitude = 360 * x;
return new Point(longitude, latitude);
}
代码示例来源:origin: neo4j/neo4j
public static DoubleValue exp( AnyValue in )
{
if ( in instanceof NumberValue )
{
return doubleValue( Math.exp( ((NumberValue) in).doubleValue() ) );
}
else
{
throw needsNumbers( "exp()" );
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
public static DoubleAD exp(DoubleAD a){
DoubleAD c = new DoubleAD();
c.setval( Math.exp(a.getval()));
c.setdot(a.getdot() * Math.exp(a.getval()));
return c;
}
代码示例来源:origin: prestodb/presto
@Test
public void testExp()
{
for (double doubleValue : DOUBLE_VALUES) {
assertFunction("exp(" + doubleValue + ")", DOUBLE, Math.exp(doubleValue));
assertFunction("exp(REAL '" + (float) doubleValue + "')", DOUBLE, Math.exp((float) doubleValue));
}
assertFunction("exp(NULL)", DOUBLE, null);
}
代码示例来源:origin: prestodb/presto
@Description("Euler's number raised to the given power")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double exp(@SqlType(StandardTypes.DOUBLE) double num)
{
return Math.exp(num);
}
代码示例来源:origin: prestodb/presto
@OutputFunction(StandardTypes.REAL)
public static void output(@AggregationState LongAndDoubleState state, BlockBuilder out)
{
long count = state.getLong();
if (count == 0) {
out.appendNull();
}
else {
REAL.writeLong(out, floatToRawIntBits((float) Math.exp(state.getDouble() / count)));
}
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
public static <T> Counter<T> exp(Counter<T> c) {
Counter<T> d = c.getFactory().create();
for (T t : c.keySet()) {
d.setCount(t, Math.exp(c.getCount(t)));
}
return d;
}
代码示例来源:origin: prestodb/presto
@OutputFunction(StandardTypes.DOUBLE)
public static void output(@AggregationState LongAndDoubleState state, BlockBuilder out)
{
long count = state.getLong();
if (count == 0) {
out.appendNull();
}
else {
DOUBLE.writeDouble(out, Math.exp(state.getDouble() / count));
}
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
double gprime(double lambdaP, int index) {
double s = 0.0;
for (int i = 0; i < p.functions.get(index).len(); i++) {
int y = ((p.functions.get(index))).getY(i);
int x = p.functions.get(index).getX(i);
s = s + p.data.ptildeX(x) * pcond(y, x) * p.functions.get(index).getVal(i) * Math.exp(lambdaP * fnum(x, y)) * fnum(x, y);
}
return s;
}
内容来源于网络,如有侵权,请联系作者删除!