Example usage for java.lang Double NEGATIVE_INFINITY

List of usage examples for java.lang Double NEGATIVE_INFINITY

Introduction

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

Prototype

double NEGATIVE_INFINITY

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

Click Source Link

Document

A constant holding the negative infinity of type double .

Usage

From source file:ArrayUtil.java

public static double max(double[] d) {
    double max = Double.NEGATIVE_INFINITY;
    for (int i = 0; i < d.length; i++)
        if (d[i] > max)
            max = d[i];/*from   ww  w .  jav a2  s .c  o  m*/
    return max;
}

From source file:MathUtil.java

public static double log(double x) {
    if (x < 0) {
        return Double.NaN;
    }/*from   w  ww  .j a va 2 s  .co m*/
    //
    if (x == 1) {
        return 0d;
    }

    if (x == 0) {
        return Double.NEGATIVE_INFINITY;
    }
    //
    if (x > 1) {
        x = 1 / x;
        return -1 * _log(x);
    }
    return _log(x);
}

From source file:com.opengamma.analytics.financial.model.option.pricing.fourier.GaussianCharacteristicExponent.java

/**
 * 
 * @return $-\infty$
 */
@Override
public double getSmallestAlpha() {
    return Double.NEGATIVE_INFINITY;
}

From source file:com.compomics.pepshell.view.statistics.RatioStatisticsScatterplotPane.java

@Override
public void setGraphData(PepshellProtein aPepshellProtein) {
    List<XYLineAnnotation> annotations = new ArrayList<>();
    XYSeriesCollection allExperiments = new XYSeriesCollection();
    for (Experiment anExperiment : experiments) {
        int proteinIndex = anExperiment.getProteins().indexOf(aPepshellProtein);
        if (proteinIndex != -1) {
            XYSeries anExperimentSeries = new XYSeries(anExperiment.getExperimentName());
            PepshellProtein experimentPepshellProtein = anExperiment.getProteins().get(proteinIndex);
            for (PeptideGroup aGroup : experimentPepshellProtein.getPeptideGroups()) {
                PeptideInterface shortestPeptide = aGroup.getRepresentativePeptide();

                if (shortestPeptide instanceof QuantedPeptide
                        && ((QuantedPeptide) shortestPeptide).getRatio() != null) {
                    Double value = Math.log(((QuantedPeptide) shortestPeptide).getRatio()) / Math.log(2);
                    //Double value = ((QuantedPeptide) shortestPeptide).getRatio();                          
                    if (value == Double.NEGATIVE_INFINITY) {
                        value = 0.0;/*from  w  w w. j a  v  a  2 s.c o m*/
                    }
                    double barWithErrors = (shortestPeptide.getEndProteinMatch()
                            + shortestPeptide.getBeginningProteinMatch()) / 2;
                    double error = Math.log(((QuantedPeptide) shortestPeptide).getStandardError())
                            / Math.log(2);
                    //double error =((QuantedPeptide) shortestPeptide).getStandardError();
                    XYLineAnnotation vertical = new XYLineAnnotation(barWithErrors, value - error,
                            barWithErrors, value + error, new BasicStroke(), Color.black);
                    XYLineAnnotation horizontalUpper = new XYLineAnnotation(value + error - 0.25, value + error,
                            value + error + 0.25, value + error, new BasicStroke(), Color.black);
                    XYLineAnnotation horizontalLower = new XYLineAnnotation(value - error - 0.25, value - error,
                            value - error + 0.25, value - error, new BasicStroke(), Color.black);

                    annotations.add(vertical);
                    annotations.add(horizontalUpper);
                    annotations.add(horizontalLower);

                    for (int i = shortestPeptide.getBeginningProteinMatch(); i < shortestPeptide
                            .getEndProteinMatch(); i++) {
                        anExperimentSeries.add(i, value);
                    }
                }

            }
            allExperiments.addSeries(anExperimentSeries);

        }
    }
    JFreeChart ratioChart = ChartFactory.createHistogram(
            "ratio for " + aPepshellProtein.getVisibleAccession() + " over all experiments", "peptide start",
            "log^2 ratio", allExperiments, PlotOrientation.VERTICAL, true, true, false);
    chart.setChart(ratioChart);
    for (XYLineAnnotation anAnnotation : annotations) {
        ((XYPlot) ratioChart.getPlot()).addAnnotation(anAnnotation);
    }
    prettifyChart(ratioChart);
}

From source file:org.jfree.data.WaferMapDataset.java

/**
 * Creates a new dataset.//from   w  w w.j a  va 2s. c  o  m
 * 
 * @param maxChipX
 *           the wafer x-dimension.
 * @param maxChipY
 *           the wafer y-dimension.
 * @param chipSpace
 *           the space between chips.
 */
public WaferMapDataset(final int maxChipX, final int maxChipY, final Number chipSpace) {

    this.maxValue = new Double(Double.NEGATIVE_INFINITY);
    this.minValue = new Double(Double.POSITIVE_INFINITY);
    this.data = new DefaultKeyedValues2D();

    this.maxChipX = maxChipX;
    this.maxChipY = maxChipY;
    if (chipSpace == null) {
        this.chipSpace = DEFAULT_CHIP_SPACE;
    } else {
        this.chipSpace = chipSpace.doubleValue();
    }

}

From source file:jasima.core.statistics.SummaryStat.java

/**
 * Resets this object./*from   w  ww  .  j a  va2  s . c  o m*/
 */
public void clear() {
    meanEst = 0.0;
    varEst = 0.0d;
    numObs = 0;
    weightSum = 0.0d;
    min = Double.POSITIVE_INFINITY;
    max = Double.NEGATIVE_INFINITY;
    lastValue = Double.NaN;
    lastWeight = Double.NaN;
}

From source file:eu.udig.tools.jgrass.profile.ProfileView.java

public void clearSeries() {
    max = Double.NEGATIVE_INFINITY;
    min = Double.POSITIVE_INFINITY;
    series.clear();
}

From source file:org.jfree.data.general.WaferMapDataset.java

/**
 * Creates a new dataset.//from   w  w  w . j  a  v a2  s .  c  o m
 *
 * @param maxChipX  the wafer x-dimension.
 * @param maxChipY  the wafer y-dimension.
 * @param chipSpace  the space between chips.
 */
public WaferMapDataset(int maxChipX, int maxChipY, Number chipSpace) {

    this.maxValue = new Double(Double.NEGATIVE_INFINITY);
    this.minValue = new Double(Double.POSITIVE_INFINITY);
    this.data = new DefaultKeyedValues2D();

    this.maxChipX = maxChipX;
    this.maxChipY = maxChipY;
    if (chipSpace == null) {
        this.chipSpace = DEFAULT_CHIP_SPACE;
    } else {
        this.chipSpace = chipSpace.doubleValue();
    }

}

From source file:com.cloudera.oryx.rdf.common.tree.DecisionTree.java

private static TreeNode build(ExampleSet examples, int buildAtDepth, int minNodeSize, double minInfoGainNats,
        int featuresToTry, int numFeatures, int suggestedMaxSplitCandidates, int maxDepth,
        RandomGenerator random) {//from w  w  w  .ja v a2s.com
    if (buildAtDepth >= maxDepth - 1 || examples.getExamples().size() < minNodeSize) {
        return new TerminalNode(Prediction.buildPrediction(examples));
    }

    double bestGain = Double.NEGATIVE_INFINITY;
    Decision bestDecision = null;

    for (int featureNumber : randomFeatures(examples, featuresToTry, numFeatures, random)) {
        Iterable<Decision> decisions = Decision.decisionsFromExamples(examples, featureNumber,
                suggestedMaxSplitCandidates);
        Pair<Decision, Double> decisionAndGain = Information.bestGain(decisions, examples);
        if (decisionAndGain != null) {
            double gain = decisionAndGain.getSecond();
            if (gain > bestGain) {
                bestGain = gain;
                bestDecision = decisionAndGain.getFirst();
            }
        }
    }

    if (Double.isNaN(bestGain) || bestGain < minInfoGainNats) {
        return new TerminalNode(Prediction.buildPrediction(examples));
    }

    bestDecision.setInformationGain(bestGain);

    ExampleSet[] negPosSplit = examples.split(bestDecision);
    examples = null; // For GC?

    TreeNode left = build(negPosSplit[0], buildAtDepth + 1, minNodeSize, minInfoGainNats, featuresToTry,
            numFeatures, suggestedMaxSplitCandidates, maxDepth, random);
    TreeNode right = build(negPosSplit[1], buildAtDepth + 1, minNodeSize, minInfoGainNats, featuresToTry,
            numFeatures, suggestedMaxSplitCandidates, maxDepth, random);

    return new DecisionNode(bestDecision, left, right);
}

From source file:org.jfree.data.statistics.DefaultStatisticalCategoryDatasetTest.java

/**
 * Some checks for the getRangeBounds() method.
 *//*from  w  w  w .j  av  a 2  s .  c om*/
@Test
public void testGetRangeBounds() {
    DefaultStatisticalCategoryDataset d = new DefaultStatisticalCategoryDataset();

    // an empty dataset should return null for bounds
    assertNull(d.getRangeBounds(true));

    // try a dataset with a single value
    d.add(4.5, 1.0, "R1", "C1");
    assertEquals(new Range(4.5, 4.5), d.getRangeBounds(false));
    assertEquals(new Range(3.5, 5.5), d.getRangeBounds(true));

    // try a dataset with two values
    d.add(0.5, 2.0, "R1", "C2");
    assertEquals(new Range(0.5, 4.5), d.getRangeBounds(false));
    assertEquals(new Range(-1.5, 5.5), d.getRangeBounds(true));

    // try a Double.NaN
    d.add(Double.NaN, 0.0, "R1", "C3");
    assertEquals(new Range(0.5, 4.5), d.getRangeBounds(false));
    assertEquals(new Range(-1.5, 5.5), d.getRangeBounds(true));

    // try a Double.NEGATIVE_INFINITY
    d.add(Double.NEGATIVE_INFINITY, 0.0, "R1", "C3");
    assertEquals(new Range(Double.NEGATIVE_INFINITY, 4.5), d.getRangeBounds(false));
    assertEquals(new Range(Double.NEGATIVE_INFINITY, 5.5), d.getRangeBounds(true));

    // try a Double.POSITIVE_INFINITY
    d.add(Double.POSITIVE_INFINITY, 0.0, "R1", "C3");
    assertEquals(new Range(0.5, Double.POSITIVE_INFINITY), d.getRangeBounds(false));
    assertEquals(new Range(-1.5, Double.POSITIVE_INFINITY), d.getRangeBounds(true));
}