Example usage for java.lang StrictMath exp

List of usage examples for java.lang StrictMath exp

Introduction

In this page you can find the example usage for java.lang StrictMath exp.

Prototype

public static double exp(double a) 

Source Link

Document

Returns Euler's number e raised to the power of a double value.

Usage

From source file:RunPageRankSchimmy.java

private static float sumLogProbs(float a, float b) {
    if (a == Float.NEGATIVE_INFINITY)
        return b;

    if (b == Float.NEGATIVE_INFINITY)
        return a;

    if (a < b) {
        return (float) (b + StrictMath.log1p(StrictMath.exp(a - b)));
    }// ww w  .  j  a  v a 2 s .c o m

    return (float) (a + StrictMath.log1p(StrictMath.exp(b - a)));
}

From source file:org.esa.beam.util.math.FastMathPerformance.java

public void testExp() {
    System.gc();//from   w  w w . j a  va  2s .  co  m
    double x = 0;
    long time = System.nanoTime();
    for (int i = 0; i < RUNS; i++)
        x += StrictMath.exp(i * F1);
    long strictTime = System.nanoTime() - time;

    System.gc();
    double y = 0;
    time = System.nanoTime();
    for (int i = 0; i < RUNS; i++)
        y += FastMath.exp(i * F1);
    long fastTime = System.nanoTime() - time;

    System.gc();
    double z = 0;
    time = System.nanoTime();
    for (int i = 0; i < RUNS; i++)
        z += Math.exp(i * F1);
    long mathTime = System.nanoTime() - time;

    report("exp", x + y + z, strictTime, fastTime, mathTime);
}

From source file:sourcefiles.RunPageRankBasic.java

private void iteratePageRank(int i, int j, String basePath, int numNodes) throws Exception {
    // Each iteration consists of two phases (two MapReduce jobs).

    // Job 1: distribute PageRank mass along outgoing edges.
    float mass = phase1(i, j, basePath, numNodes);

    // Find out how much PageRank mass got lost at the dangling nodes.
    float missing = 1.0f - (float) StrictMath.exp(mass);

    // Job 2: distribute missing mass, take care of random jump factor.
    phase2(i, j, missing, basePath, numNodes);
}