Example usage for java.lang Double NaN

List of usage examples for java.lang Double NaN

Introduction

In this page you can find the example usage for java.lang Double NaN.

Prototype

double NaN

To view the source code for java.lang Double NaN.

Click Source Link

Document

A constant holding a Not-a-Number (NaN) value of type double .

Usage

From source file:bide.core.par.Spot.java

private double generateRandomValue() {

    boolean isNa = rand.nextBoolean();
    if (isNa) {//from   w ww  .  j a v  a2s  .  co m
        return Double.NaN;
    } else {
        return rand.nextGaussian();
    }
}

From source file:it.unibo.alchemist.model.implementations.actions.RunProtelisProgram.java

/**
 * @param env/*  w  ww  . java  2  s . co  m*/
 *            the environment
 * @param n
 *            the node
 * @param r
 *            the reaction
 * @param rand
 *            the random engine
 * @param prog
 *            the Protelis program
 * @throws SecurityException
 *             if you are not authorized to load required classes
 * @throws ClassNotFoundException
 *             if required classes can not be found
 */
public RunProtelisProgram(final Environment<Object> env, final ProtelisNode n, final Reaction<Object> r,
        final RandomGenerator rand, final String prog) throws SecurityException, ClassNotFoundException {
    this(env, n, r, rand, prog, Double.NaN);
}

From source file:edu.harvard.med.screensaver.analysis.heatmaps.HeatMap.java

public double getRawValue(int row, int column) {
    ResultValue rv = getResultValue(row, column);
    if (rv == null || rv.getNumericValue() == null) {
        return Double.NaN;
    }/*ww w  .j a  v a2 s  .  co  m*/
    return rv.getNumericValue();
}

From source file:org.objectweb.proactive.extensions.timitspmd.util.charts.renderer.HierarchicalBarRenderer.java

/**
 * Returns the bar width for a series, or <code>Double.NaN</code> if no
 * width has been set.//from  w w  w  .ja  v a2  s  .  c  o m
 *
 * @param series
 *            the series index (zero based).
 *
 * @return The width for the series (1.0=100%, it is the maximum).
 */
public double getSeriesBarWidth(int series) {
    double result = Double.NaN;
    Number n = (Number) this.seriesBarWidthList.get(series);
    if (n != null) {
        result = n.doubleValue();
    }
    return result;
}

From source file:com.cloudera.oryx.kmeans.common.ClusterValidityStatistics.java

/**
 * Calculates the normalized van Dongen criterion for the contingency contingencyMatrix.
 *
 * @return the normalized van Dongen criterion for the contingency contingencyMatrix
 *//*w w  w  .ja v  a 2 s  .  c om*/
private static double normVanDongen(RealMatrix contingencyMatrix, double[] rowSums, double[] colSums,
        double n) {
    double rs = 0.0;
    double cs = 0.0;
    double rmax = 0.0;
    double cmax = 0.0;
    for (int i = 0; i < rowSums.length; i++) {
        rs += contingencyMatrix.getRowVector(i).getLInfNorm();
        cs += contingencyMatrix.getColumnVector(i).getLInfNorm();
        rmax = Math.max(rmax, rowSums[i]);
        cmax = Math.max(cmax, colSums[i]);
    }
    double den = 2 * n - rmax - cmax;
    if (den == 0.0) {
        return Double.NaN;
    }
    return (2 * n - rs - cs) / den;
}

From source file:eu.crisis_economics.utilities.EmpiricalDistribution.java

public void flush() {
    m_dataStream.clear();
    m_sortedData.clear();
    lastValueInserted = Double.NaN;
    maxRecordValue = Double.NaN;
    minRecordValue = Double.NaN;
}

From source file:gedi.util.math.stat.testing.DirichletLikelihoodRatioTest.java

public static double effectSizeMultinomials(double pseudo, double[]... samples) {

    double[][] psamples = new double[samples.length][];
    assert samples.length > 1;
    BitVector nans = new BitVector(samples[0].length);
    for (int i = 0; i < samples.length; i++) {
        assert samples[i].length == samples[0].length;
        for (int j = 0; j < samples[i].length; j++)
            if (Double.isNaN(samples[i][j]))
                nans.putQuick(j, true);//from  w ww  . jav  a 2  s .  c  o m
    }
    nans.not();

    double sum = 0;
    for (int i = 0; i < samples.length; i++) {
        psamples[i] = ArrayUtils.restrict(samples[i], nans);

        assert ArrayUtils.min(psamples[i]) >= 0;
        sum += ArrayUtils.sum(psamples[i]);
    }

    for (int i = 0; i < samples.length; i++) {
        ArrayUtils.add(psamples[i], pseudo * ArrayUtils.sum(psamples[i]) / sum);
    }

    int dim = psamples[0].length;
    int obj = psamples.length;
    if (dim < 2)
        return Double.NaN;
    if (obj != 2)
        throw new RuntimeException("Can only compute the effect size for a pair of samples!");

    double exp = (Math.log(ArrayUtils.sum(psamples[0])) - Math.log(ArrayUtils.sum(psamples[1]))) / Math.log(2);

    double re = 0;
    for (int i = 0; i < dim; i++) {
        re += Math.abs(exp - (Math.log(psamples[0][i]) - Math.log(psamples[1][i])) / Math.log(2));
    }

    return re;

}

From source file:geogebra.util.MyMath.java

/**
 * Factorial function of x. If x is an integer value x! is returned,
 * otherwise gamma(x + 1) will be returned. For x < 0 Double.NaN is
 * returned./*from w ww .  jav  a  2 s .co m*/
 * @param x 
 * @return factorial
 */
final public static double factorial(double x) {

    if (x < 0)
        return Double.NaN; // bugfix Michael Borcherds 2008-05-04

    // big x or floating point x is computed using gamma function
    if (x < 0 || x > 32 || x - Math.floor(x) > 1E-10)
        // exp of log(gamma(x+1))
        return Math.exp(Gamma.logGamma(x + 1.0));

    int n = (int) x;
    int j;
    while (factorialTop < n) {
        j = factorialTop++;
        factorialTable[factorialTop] = factorialTable[j] * factorialTop;
    }
    return factorialTable[n];
}

From source file:com.fay.statics.SummaryStat.java

public double min() {
    if (numObs < 1)
        return Double.NaN;
    return min;
}

From source file:com.cognitect.transit.TransitTest.java

public void testReadSpecialNumbers() throws IOException {
    assertEquals(Double.NaN, reader("\"~zNaN\"").read());
    assertEquals(Double.POSITIVE_INFINITY, reader("\"~zINF\"").read());
    assertEquals(Double.NEGATIVE_INFINITY, reader("\"~z-INF\"").read());
}