List of usage examples for java.lang Double NaN
double NaN
To view the source code for java.lang Double NaN.
Click Source Link
From source file:org.jfree.data.RangeTest.java
/** * Simple tests for the contains() method. *///from w ww .j a v a 2s . c om @Test public void testContains() { Range r1 = new Range(0.0, 1.0); assertFalse(r1.contains(Double.NaN)); assertFalse(r1.contains(Double.NEGATIVE_INFINITY)); assertFalse(r1.contains(-1.0)); assertTrue(r1.contains(0.0)); assertTrue(r1.contains(0.5)); assertTrue(r1.contains(1.0)); assertFalse(r1.contains(2.0)); assertFalse(r1.contains(Double.POSITIVE_INFINITY)); }
From source file:dr.math.distributions.NegativeBinomialDistribution.java
public static double cdf(double x, double mean, double alpha) { double theta = 1.0 / alpha; double p = theta / (theta + mean); try {// ww w.j a v a 2 s. c om return Beta.regularizedBeta(p, theta, x + 1); } catch (MathException e) { // AR - throwing exceptions deep in numerical code causes trouble. Catching runtime // exceptions is bad. Better to return NaN and let the calling code deal with it. return Double.NaN; // throw MathRuntimeException.createIllegalArgumentException( // "Couldn't calculate beta cdf for alpha = " + alpha + ", beta = " + beta + ": " +e.getMessage()); } }
From source file:de.tudarmstadt.ukp.csniper.webapp.statistics.FleissKappaTest.java
@Ignore @Test/*from w ww .j a v a2 s . c o m*/ public void testCompleteAgreementOneSided() { // this is NaN because of a division by zero in Fleiss' Kappa Formula; // for these ratings we have P^_e = 1 // vector is (2-0, 2-0) [Correct-Wrong] test("c1", "type1,type2", "user1,user2", Double.NaN); }
From source file:zoocen.world.java
public void runCycles() { int iterations = 0; while (iterations < this.parameters.iterations) { if (stopSignal) { break; }/* www . ja va 2 s . c om*/ if (!pauseSignal) { for (int e = 0; e < this.cells.size(); e++) { if (stopSignal) { break; } Cell j = this.cells.elementAt(e); double[] N = new double[(int) j.getNSpecies()]; for (int i = 0; i < j.getNSpecies(); i++) { System.out.println("Euler parameter " + this.parameters.Euler); System.out.println("j.getname " + j.getName(i)); System.out.println("j.getN " + j.getN(i)); System.out.println("this.getCompetence(j, i) " + this.getCompetence(j, i)); System.out.println("this.getDifusion(j, i) " + this.getDifusion(j, i)); System.out.println("j.getMortalityRate(i) " + j.getMortalityRate(i)); N[i] = j.getN(i) + (this.parameters.Euler * ((j.getGrowingRate(i) * j.getN(i) * this.getCompetence(j, i)) + this.getDifusion(j, i) - (j.getMortalityRate(i) * j.getN(i)))); if (N[i] / j.getMaximInhabitants(i) > 1) { N[i] = j.getMaximInhabitants(i); } if (N[i] == Double.NaN) { N[i] = 0; } j.setOldN(N[i], i); } this.chart[e].addData(N, iterations); this.bigchart[e].addData(N, iterations); } for (int i = 0; i < this.cells.size(); i++) { Cell j = this.cells.elementAt(i); j.updateN(); } iterations++; } } }
From source file:jhn.eda.EDA.java
@Override public double logLikelihood() throws Exception { if (!usingSymmetricAlpha) throw new UnsupportedOperationException( "Log likelihood computation is unreasonably slow with assymetric alphas"); //NOTE: assumes symmetric alphas! final double alpha = alphas[0]; final double Kalpha = numTopics * alpha; final double log_gamma_alpha = Gamma.logGamma(alpha); double ll = Gamma.logGamma(Kalpha); ll -= numTopics * log_gamma_alpha;// ww w. j a v a 2s .co m int nonZeroTopics; int zeroTopics; IntIntCounter docTopicCounts; for (int docNum = 0; docNum < numDocs; docNum++) { docTopicCounts = docTopicCounts(docNum); // Deal with non-zero-count topics: for (Int2IntMap.Entry entry : docTopicCounts.int2IntEntrySet()) { ll += Gamma.logGamma(entry.getIntValue() + alpha); } // Deal with zero-count topics: nonZeroTopics = docTopicCounts.size(); zeroTopics = numTopics - nonZeroTopics; ll += zeroTopics * log_gamma_alpha; ll -= Gamma.logGamma(tokens[docNum].length + Kalpha); for (int position = 0; position < docLengths[docNum]; position++) { double topicWordProb = Double.NaN; Iterator<TopicCount> it = typeTopicCounts.typeTopicCounts(tokens[docNum][position]); while (it.hasNext()) { TopicCount tc = it.next(); if (tc.topic == topics[docNum][position]) { topicWordProb = (double) tc.count / (double) topicCorpusTopicCounts.topicCount(tc.topic); break; } } if (Double.isNaN(topicWordProb)) { System.err.println(topics[docNum][position]); } else { ll += FastMath.log(topicWordProb); } } } return ll; }
From source file:org.jfree.data.xy.XYDataItem.java
/** * Returns the y-value as a double primitive. * * @return The y-value./* ww w . j a v a 2 s. co m*/ * * @see #getY() * @see #getXValue() * * @since 1.0.9 */ public double getYValue() { double result = Double.NaN; if (this.y != null) { result = this.y.doubleValue(); } return result; }
From source file:com.fay.statics.SummaryStat.java
public double max() { if (numObs < 1) return Double.NaN; return max; }
From source file:net.triptech.metahive.model.KeyValue.java
@PrePersist @PreUpdate/*from w ww.ja v a 2s .c o m*/ protected void preCreateOrUpdate() { if (doubleValue != null) { if (doubleValue == Double.NaN || doubleValue == Double.POSITIVE_INFINITY || doubleValue == Double.NEGATIVE_INFINITY) { doubleValue = null; } } // Update the modified date modified = new Date(); }
From source file:Float11.java
static private double _log(double x) { if (!(x > 0.)) return Double.NaN; ///*from w w w . j a va 2 s . c om*/ double f = 0.0; // int appendix = 0; while (x > 0.0 && x <= 1.0) { x *= 2.0; appendix++; } // x /= 2.0; appendix--; // double y1 = x - 1.; double y2 = x + 1.; double y = y1 / y2; // double k = y; y2 = k * y; // for (long i = 1; i < 50; i += 2) { f += k / i; k *= y2; } // f *= 2.0; for (int i = 0; i < appendix; i++) f += LOGdiv2; // return f; }
From source file:com.cti.vpx.controls.graph.utilities.ui.graphs.waterfallGraph.Variance.java
public void clear() { m1 = Double.NaN; n = 0; dev = Double.NaN; nDev = Double.NaN; m2 = Double.NaN; }