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:gedi.lfc.foldchange.PosteriorMeanLog2FoldChange.java
@Override public double computeFoldChange(double a, double b) { if (Double.isNaN(a) || Double.isNaN(b)) return Double.NaN; return (Gamma.digamma(a + priorA) - Gamma.digamma(b + priorB)) / Math.log(2); }
From source file:Util.java
public static double median(double[] values) { double[] v = new double[values.length]; double median = Double.NaN; if (v == null || v.length == 0) { throw new IllegalArgumentException("The data array either is null or does not contain any data."); } else if (v.length == 1) { median = v[0];//from w w w.j a va 2s .c o m } else { System.arraycopy(values, 0, v, 0, values.length); Arrays.sort(v); if (isEven(v.length)) { int i = (int) Math.ceil(v.length / 2D); double n1 = v[i]; double n0 = v[i - 1]; median = (n0 + n1) / 2; } else { median = v[v.length / 2]; } } return median; }
From source file:Main.java
/** * <p>Returns the minimum value in an array.</p> * * @param array an array, must not be null or empty * @return the minimum value in the array * @throws IllegalArgumentException if <code>array</code> is <code>null</code> * @throws IllegalArgumentException if <code>array</code> is empty * @see IEEE754rUtils#min(double[]) IEEE754rUtils for a version of this method that handles NaN differently *//*w w w . j a v a2 s.c o m*/ public static double min(double[] array) { // Validates input if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } // Finds and returns min double min = array[0]; for (int i = 1; i < array.length; i++) { if (Double.isNaN(array[i])) { return Double.NaN; } if (array[i] < min) { min = array[i]; } } return min; }
From source file:Main.java
/** * <p>Returns the maximum value in an array.</p> * //from ww w . j av a 2 s. c om * @param array an array, must not be null or empty * @return the minimum value in the array * @throws IllegalArgumentException if <code>array</code> is <code>null</code> * @throws IllegalArgumentException if <code>array</code> is empty * @see IEEE754rUtils#max(double[]) IEEE754rUtils for a version of this method that handles NaN differently */ public static double max(double[] array) { // Validates input if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } // Finds and returns max double max = array[0]; for (int j = 1; j < array.length; j++) { if (Double.isNaN(array[j])) { return Double.NaN; } if (array[j] > max) { max = array[j]; } } return max; }
From source file:com.liferay.dynamic.data.mapping.form.evaluator.internal.functions.IsDecimalFunction.java
@Override public Object evaluate(Object... parameters) { if (parameters.length != 1) { throw new IllegalArgumentException("One parameter is expected"); }/*from www .j av a 2 s .com*/ Double value = NumberUtils.toDouble(parameters[0].toString(), Double.NaN); return !value.isNaN(); }
From source file:dbseer.gui.panel.DBSeerPredictionInformationChartPanel.java
public DBSeerPredictionInformationChartPanel(JFreeChart chart) { super(chart); verticalCrossHair = new Crosshair(Double.NaN, Color.GRAY, new BasicStroke(0f)); CrosshairOverlay crosshairOverlay = new CrosshairOverlay(); crosshairOverlay.addDomainCrosshair(verticalCrossHair); this.addOverlay(crosshairOverlay); }
From source file:de.qaware.chronix.solr.type.metric.functions.aggregations.Avg.java
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return;//www . ja v a2s .c om } //Else calculate the analysis value int size = timeSeries.size(); double current = 0; for (int i = 0; i < size; i++) { current += timeSeries.getValue(i); } functionValueMap.add(this, current / timeSeries.size()); }
From source file:net.myrrix.common.stats.IntWeightedMean.java
public IntWeightedMean() { this(0, Double.NaN); }
From source file:com.joliciel.jochre.stats.MeanAbsoluteDeviation.java
public void clear() { values.clear(); meanAbsoluteDeviation = Double.NaN; dirty = false; }
From source file:net.myrrix.common.stats.DoubleWeightedMean.java
public DoubleWeightedMean() { this(0.0, Double.NaN); }