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:Main.java

public static void main(String[] args) {

    double d1 = 0.0, d2 = -0.0, d3 = (1.0 / 0.0), d4 = 5;

    // returns Euler's number e raised to the power positive 0 
    System.out.println("Euler value of d1 = " + StrictMath.exp(d1));

    // returns Euler's number e raised to the power negative 0
    System.out.println("Euler value of d2 = " + StrictMath.exp(d2));

    // returns Euler's number e raised to the power infinity
    System.out.println("Euler value of d3 = " + StrictMath.exp(d3));

    // returns Euler's number e raised to the power 5
    System.out.println("Euler value of d4 = " + StrictMath.exp(d4));
}

From source file:net.nicoulaj.benchmarks.math.DoubleExp.java

@GenerateMicroBenchmark
public void strictmath(BlackHole hole) {
    for (int i = 0; i < data.length - 1; i++)
        hole.consume(StrictMath.exp(data[i]));
}

From source file:edu.umd.windmemory.RunPersonalizedPageRankBasic.java

private void iteratePageRank(int i, int j, String basePath, int numNodes, String sources) 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, sources);
    // Find out how much PageRank mass got lost at the dangling nodes.
    float[] missing = new float[mass.length];
    for (int m = 0; m < mass.length; m++) {
        missing[m] = 1.0f - (float) StrictMath.exp(mass[m]);
    }/*from  w  w w  . ja  v a  2s  . c om*/
    // Job 2: distribute missing mass, take care of random jump factor.
    phase2(i, j, missing, basePath, numNodes, sources);
}

From source file:edu.umd.gorden2.RunPersonalizedPageRankBasic.java

private void iteratePageRank(int i, int j, String basePath, int numNodes, String m) 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, m);

    // Find out how much PageRank mass got lost at the dangling nodes.
    String[] mm = m.split(",");
    float[] missing = new float[mm.length];
    for (int x = 0; x < mm.length; x++) {
        missing[x] = 1.0f - (float) StrictMath.exp(mass[x]);
    }// w  w  w . j  a  v a 2  s  .c o  m

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

From source file:RunPageRankBasic.java

private void iteratePageRank(int i, int j, String basePath, int numNodes, boolean useCombiner,
        boolean useInMapperCombiner) 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, useCombiner, useInMapperCombiner);

    // 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);
}

From source file:RunPersonalizedPageRankBasic.java

private void iteratePageRank(int i, int j, String basePath, int numNodes, boolean useCombiner, String sources)
        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, useCombiner, sources);

    // 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, sources);
}

From source file:edu.umd.honghongie.RunPersonalizedPageRankBasic.java

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

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

    System.out.println("*********** 1 ***********" + mass.toString());

    // Find out how much PageRank mass got lost at the dangling nodes.
    ArrayListOfFloats missing = new ArrayListOfFloats();

    for (int k = 0; k < sourceids.size(); k++) {
        missing.add(1.0f - (float) StrictMath.exp(mass.get(k)));
    }//from w  ww .j a v  a  2 s  .c  o  m

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

From source file:RunPageRankSchimmy.java

private void iteratePageRank(String path, int i, int j, int n, boolean useCombiner, boolean useInmapCombiner,
        boolean useRange) throws Exception {
    // Each iteration consists of two phases (two MapReduce jobs).

    // Job1: distribute PageRank mass along outgoing edges.
    float mass = phase1(path, i, j, n, useCombiner, useInmapCombiner, useRange);

    // Find out how much PageRank mass got lost at the dangling nodes.
    float missing = 1.0f - (float) StrictMath.exp(mass);
    if (missing < 0.0f) {
        missing = 0.0f;/* w  w  w.j  a va 2 s.  c o  m*/
    }

    // Job2: distribute missing mass, take care of random jump factor.
    phase2(path, i, j, n, missing);
}

From source file:edu.umd.shrawanraina.RunPersonalizedPageRankBasic.java

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

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

    // 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(sources, i, j, missing, basePath, numNodes);
}

From source file:edu.umd.honghongie.RunPersonalizedPageRankBasic.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)));
    }//from   w ww .  j ava2  s.  co m
    return (float) (a + StrictMath.log1p(StrictMath.exp(b - a)));
}