Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

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

Prototype

double MIN_VALUE

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

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

From source file:ubic.gemma.analysis.preprocess.TwoChannelMissingValuesImpl.java

/**
 * Determine a threshold based on the data.
 * //from   www  . j a va  2  s  . com
 * @param preferred
 * @param signalChannelA
 * @param signalChannelB
 * @param baseChannel
 */
private Double computeSignalThreshold(ExpressionDataDoubleMatrix preferred,
        ExpressionDataDoubleMatrix signalChannelA, ExpressionDataDoubleMatrix signalChannelB,
        ExpressionDataDoubleMatrix baseChannel) {

    Double min = Double.MAX_VALUE;
    Double max = Double.MIN_VALUE;

    for (ExpressionDataMatrixRowElement element : baseChannel.getRowElements()) {
        CompositeSequence designElement = element.getDesignElement();

        int numCols = preferred.columns(designElement);
        for (int col = 0; col < numCols; col++) {

            Double[] signalA = null;
            if (signalChannelA != null) {
                signalA = signalChannelA.getRow(designElement);
            }

            Double[] signalB = null;
            if (signalChannelB != null) {
                signalB = signalChannelB.getRow(designElement);
            }

            Double sigAV = (signalA == null || signalA[col] == null) ? Double.NaN : signalA[col];
            Double sigBV = (signalB == null || signalB[col] == null) ? Double.NaN : signalB[col];

            if (!sigAV.isNaN() && sigAV < min) {
                min = sigAV;
            } else if (!sigBV.isNaN() && sigBV < min) {
                min = sigBV;
            } else if (!sigAV.isNaN() && sigAV > max) {
                max = sigAV;
            } else if (!sigBV.isNaN() && sigBV > max) {
                max = sigBV;
            }

        }
    }

    Histogram h = new Histogram("range", 100, min, max);
    for (ExpressionDataMatrixRowElement element : baseChannel.getRowElements()) {
        CompositeSequence designElement = element.getDesignElement();

        int numCols = preferred.columns(designElement);
        for (int col = 0; col < numCols; col++) {

            Double[] signalA = null;
            if (signalChannelA != null) {
                signalA = signalChannelA.getRow(designElement);
            }

            Double[] signalB = null;
            if (signalChannelB != null) {
                signalB = signalChannelB.getRow(designElement);
            }

            Double sigAV = (signalA == null || signalA[col] == null) ? Double.NaN : signalA[col];
            Double sigBV = (signalB == null || signalB[col] == null) ? Double.NaN : signalB[col];

            if (!sigAV.isNaN())
                h.fill(sigAV);
            if (!sigBV.isNaN())
                h.fill(sigBV);

        }
    }

    Double thresh = h.getApproximateQuantile(QUANTILE_OF_SIGNAL_TO_USE_IF_NO_BKG_AVAILABLE);

    log.info("Threshold based on signal=" + thresh);

    return thresh;
}

From source file:experiment.SimpleRegression_bug.java

/**
* Returns the slope of the estimated regression line.
* <p>// w ww. j  ava2 s  . c  o  m
* The least squares estimate of the slope is computed using the
* <a href="http://www.xycoon.com/estimation4.htm">normal equations</a>.
* The slope is sometimes denoted b1.</p>
* <p>
* <strong>Preconditions</strong>: <ul>
* <li>At least two observations (with at least two different x values)
* must have been added before invoking this method. If this method is
* invoked before a model can be estimated, <code>Double.NaN</code> is
* returned.
* </li></ul></p>
*
* @return the slope of the regression line
*/
public double getSlope() {
    if (n < 2) {
        return Double.NaN; //not enough data
    }
    if (FastMath.abs(sumXX) < 10 * Double.MIN_VALUE) {
        return Double.NaN; //not enough variation in x
    }
    return sumXY / sumXX;
}

From source file:de.dfki.madm.anomalydetection.operator.statistical_based.RobustPCAOperator.java

@Override
public List<ParameterType> getParameterTypes() {
    List<ParameterType> list = super.getParameterTypes();

    list.add(new ParameterTypeDouble(PARAMETER_OUTLIER_PROBABILITY, PARAMETER_OUTLIER_PROBABILITY_DESCRIPTION,
            0, 1.0, 0.975, false));//ww w  . j  a  v  a 2  s.c  om

    ParameterType type = new ParameterTypeCategory(PARAMETER_REDUCTION_TYPE,
            PARAMETER_REDUCTION_TYPE_DESCRIPTION, PCS_METHODS, PCS_ALL);
    type.setExpert(false);
    list.add(type);

    type = new ParameterTypeCategory(PARAMETER_TOP_METHODS, PARAMETER_TOP_METHODS_DESCRIPTION, PCS_TOP_METHODS,
            PCS_TOP_VAR);
    type.setExpert(false);
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_REDUCTION_TYPE, PCS_METHODS, false, PCS_TOP, PCS_BOTH));
    list.add(type);

    type = new ParameterTypeDouble(PARAMETER_VARIANCE_THRESHOLD, PARAMETER_VARIANCE_THRESHOLD_DESCRIPTION,
            Double.MIN_VALUE, 1, 0.50);
    type.setExpert(false);
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_REDUCTION_TYPE, PCS_METHODS, true, PCS_TOP, PCS_BOTH));
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_TOP_METHODS, PCS_TOP_METHODS, true, PCS_TOP_VAR));
    list.add(type);

    type = new ParameterTypeInt(PARAMETER_NUMBER_OF_COMPONENTS_TOP,
            PARAMETER_NUMBER_OF_COMPONENTS_TOP_DESCRIPTION, 1, Integer.MAX_VALUE, 1);
    type.setExpert(false);
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_REDUCTION_TYPE, PCS_METHODS, true, PCS_TOP, PCS_BOTH));
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_TOP_METHODS, PCS_TOP_METHODS, true, PCS_TOP_FIX));
    list.add(type);

    type = new ParameterTypeCategory(PARAMETER_LOW_METHODS, PARAMETER_LOW_METHODS_DESCRIPTION, PCS_LOW_METHODS,
            PCS_LOW_VAL);
    type.setExpert(false);
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_REDUCTION_TYPE, PCS_METHODS, false, PCS_LOWER, PCS_BOTH));
    list.add(type);

    type = new ParameterTypeDouble(PARAMETER_VALUE_THRESHOLD, PARAMETER_VALUE_THRESHOLD_DESCRIPTION, 0,
            Double.MAX_VALUE, 0.20);
    type.setExpert(false);
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_REDUCTION_TYPE, PCS_METHODS, true, PCS_LOWER, PCS_BOTH));
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_LOW_METHODS, PCS_LOW_METHODS, true, PCS_LOW_VAL));
    list.add(type);

    type = new ParameterTypeInt(PARAMETER_NUMBER_OF_COMPONENTS_LOW,
            PARAMETER_NUMBER_OF_COMPONENTS_LOW_DESCRIPTION, 1, Integer.MAX_VALUE, 1);
    type.setExpert(false);
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_REDUCTION_TYPE, PCS_METHODS, true, PCS_LOWER, PCS_BOTH));
    type.registerDependencyCondition(
            new EqualTypeCondition(this, PARAMETER_LOW_METHODS, PCS_LOW_METHODS, true, PCS_LOW_FIX));
    list.add(type);

    return list;
}

From source file:org.qi4j.runtime.value.CollectionTypeTest.java

private Collection<Double> doubleCollection() {
    Collection<Double> value = new ArrayList<Double>();
    value.add(-1.0);//from w w  w.ja  v  a2s.c  om
    value.add(1.0);
    value.add(0.0);
    value.add(Double.MAX_VALUE);
    value.add(null);
    value.add(Double.MIN_VALUE);
    value.add(0.123456);
    value.add(-0.232321);
    return value;
}

From source file:ubic.gemma.core.analysis.preprocess.TwoChannelMissingValuesImpl.java

/**
 * Determine a threshold based on the data.
 *//*w w w.  j ava  2 s. co  m*/
private Double computeSignalThreshold(ExpressionDataDoubleMatrix preferred,
        ExpressionDataDoubleMatrix signalChannelA, ExpressionDataDoubleMatrix signalChannelB,
        ExpressionDataDoubleMatrix baseChannel) {

    Double min = Double.MAX_VALUE;
    Double max = Double.MIN_VALUE;

    for (ExpressionDataMatrixRowElement element : baseChannel.getRowElements()) {
        CompositeSequence designElement = element.getDesignElement();

        int numCols = preferred.columns(designElement);
        for (int col = 0; col < numCols; col++) {

            Double[] signalA = null;
            if (signalChannelA != null) {
                signalA = signalChannelA.getRow(designElement);
            }

            Double[] signalB = null;
            if (signalChannelB != null) {
                signalB = signalChannelB.getRow(designElement);
            }

            Double sigAV = (signalA == null || signalA[col] == null) ? Double.NaN : signalA[col];
            Double sigBV = (signalB == null || signalB[col] == null) ? Double.NaN : signalB[col];

            if (!sigAV.isNaN() && sigAV < min) {
                min = sigAV;
            } else if (!sigBV.isNaN() && sigBV < min) {
                min = sigBV;
            } else if (!sigAV.isNaN() && sigAV > max) {
                max = sigAV;
            } else if (!sigBV.isNaN() && sigBV > max) {
                max = sigBV;
            }

        }
    }

    Histogram h = new Histogram("range", 100, min, max);
    for (ExpressionDataMatrixRowElement element : baseChannel.getRowElements()) {
        CompositeSequence designElement = element.getDesignElement();

        int numCols = preferred.columns(designElement);
        for (int col = 0; col < numCols; col++) {

            Double[] signalA = null;
            if (signalChannelA != null) {
                signalA = signalChannelA.getRow(designElement);
            }

            Double[] signalB = null;
            if (signalChannelB != null) {
                signalB = signalChannelB.getRow(designElement);
            }

            Double sigAV = (signalA == null || signalA[col] == null) ? Double.NaN : signalA[col];
            Double sigBV = (signalB == null || signalB[col] == null) ? Double.NaN : signalB[col];

            if (!sigAV.isNaN())
                h.fill(sigAV);
            if (!sigBV.isNaN())
                h.fill(sigBV);

        }
    }

    Double thresh = h
            .getApproximateQuantile(TwoChannelMissingValuesImpl.QUANTILE_OF_SIGNAL_TO_USE_IF_NO_BKG_AVAILABLE);

    TwoChannelMissingValuesImpl.log.info("Threshold based on signal=" + thresh);

    return thresh;
}

From source file:org.locationtech.udig.processingtoolbox.tools.HistogramDialog.java

private void updateChart(SimpleFeatureCollection features, String field) {
    int bin = spinner.getSelection();

    double[] values = getValues(features, field);
    HistogramDataset dataset = new HistogramDataset();
    dataset.addSeries(field, values, bin, minMaxVisitor.getMinX(), minMaxVisitor.getMaxX());
    dataset.setType(histogramType);//from   ww  w  . j  av  a  2s .  com

    JFreeChart chart = ChartFactory.createHistogram(EMPTY, null, null, dataset, PlotOrientation.VERTICAL, false,
            false, false);

    // 1. Create a single plot containing both the scatter and line
    chart.setBackgroundPaint(java.awt.Color.WHITE);
    chart.setBorderVisible(false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setForegroundAlpha(0.85F);
    plot.setBackgroundPaint(java.awt.Color.WHITE);
    plot.setOrientation(PlotOrientation.VERTICAL);

    plot.setDomainGridlinePaint(java.awt.Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(java.awt.Color.LIGHT_GRAY);

    int fontStyle = java.awt.Font.BOLD;
    FontData fontData = getShell().getDisplay().getSystemFont().getFontData()[0];

    NumberAxis valueAxis = new NumberAxis(cboField.getText());
    valueAxis.setLabelFont(new Font(fontData.getName(), fontStyle, 12));
    valueAxis.setTickLabelFont(new Font(fontData.getName(), fontStyle, 10));

    valueAxis.setAutoRange(false);
    valueAxis.setRange(minMaxVisitor.getMinX(), minMaxVisitor.getMaxX());

    String rangeAxisLabel = histogramType == HistogramType.FREQUENCY ? "Frequency" : "Ratio"; //$NON-NLS-1$ //$NON-NLS-2$
    NumberAxis rangeAxis = new NumberAxis(rangeAxisLabel);
    rangeAxis.setLabelFont(new Font(fontData.getName(), fontStyle, 12));
    rangeAxis.setTickLabelFont(new Font(fontData.getName(), fontStyle, 10));
    if (histogramType == HistogramType.FREQUENCY) {
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    }

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setShadowVisible(false);
    CustomXYBarPainter.selectedColumn = -1; // init
    renderer.setBarPainter(new CustomXYBarPainter());
    renderer.setAutoPopulateSeriesFillPaint(true);
    renderer.setAutoPopulateSeriesPaint(true);
    renderer.setShadowXOffset(3);
    renderer.setMargin(0.01);
    renderer.setBaseItemLabelsVisible(true);

    ItemLabelPosition pos = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.TOP_CENTER);
    renderer.setBasePositiveItemLabelPosition(pos);

    XYToolTipGenerator plotToolTip = new StandardXYToolTipGenerator();
    renderer.setBaseToolTipGenerator(plotToolTip);

    // color
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, java.awt.Color.GRAY, 0.0f, 0.0f,
            java.awt.Color.LIGHT_GRAY);
    renderer.setSeriesPaint(0, gp0);

    plot.setDomainAxis(0, valueAxis);
    plot.setRangeAxis(0, rangeAxis);

    // 3. Setup line
    // Create the line data, renderer, and axis
    XYItemRenderer lineRenderer = new XYLineAndShapeRenderer(true, false); // Lines only
    lineRenderer.setSeriesPaint(0, java.awt.Color.RED);
    lineRenderer.setSeriesStroke(0, new BasicStroke(2f));

    // Set the line data, renderer, and axis into plot
    NumberAxis xLineAxis = new NumberAxis(EMPTY);
    xLineAxis.setTickMarksVisible(false);
    xLineAxis.setTickLabelsVisible(false);
    xLineAxis.setAutoRange(false);

    NumberAxis yLineAxis = new NumberAxis(EMPTY);
    yLineAxis.setTickMarksVisible(false);
    yLineAxis.setTickLabelsVisible(false);
    yLineAxis.setAutoRange(false);

    double maxYValue = Double.MIN_VALUE;
    for (int i = 0; i < dataset.getItemCount(0); i++) {
        maxYValue = Math.max(maxYValue, dataset.getYValue(0, i));
    }

    XYSeriesCollection lineDatset = new XYSeriesCollection();

    // Vertical Average
    XYSeries vertical = new XYSeries("Average"); //$NON-NLS-1$
    vertical.add(minMaxVisitor.getAverageX(), 0);
    vertical.add(minMaxVisitor.getAverageX(), maxYValue);
    lineDatset.addSeries(vertical);

    plot.setDataset(1, lineDatset);
    plot.setRenderer(1, lineRenderer);
    plot.setDomainAxis(1, xLineAxis);
    plot.setRangeAxis(1, yLineAxis);

    // Map the line to the second Domain and second Range
    plot.mapDatasetToDomainAxis(1, 0);
    plot.mapDatasetToRangeAxis(1, 0);

    chartComposite.setChart(chart);
    chartComposite.forceRedraw();
}

From source file:net.ymate.platform.commons.lang.TreeObject.java

/**
 * 
 *
 * @param d
 */
public TreeObject(Double d) {
    _object = d != null ? d.doubleValue() : Double.MIN_VALUE;
    _type = TYPE_DOUBLE;
}

From source file:geogebra.common.kernel.EquationSolver.java

private static double findZero(double init, double target, double eqn[]) {
    double t = init;
    double slopeqn[] = { eqn[1], 2 * eqn[2], 3 * eqn[3] };
    double slope;
    double origdelta = 0;
    double origt = t;
    while (true) {
        slope = solveEqn(slopeqn, 2, t);
        if (slope == 0.0)
            // At a local minima - must return
            return t;
        double y = solveEqn(eqn, 3, t);
        if (y == 0.0)
            // Found it! - return it
            return t;
        // assert(slope != 0 && y != 0);
        double delta = -(y / slope);
        // assert(delta != 0);
        if (origdelta == 0.0) {
            origdelta = delta;/*from  w  w  w .ja  v  a  2s. c o m*/
        }
        if (t < target) {
            if (delta < 0)
                return t;
        } else if (t > target) {
            if (delta > 0)
                return t;
        } else
            return (delta > 0 ? (target + java.lang.Double.MIN_VALUE) : (target - java.lang.Double.MIN_VALUE));
        double newt = t + delta;
        if (t == newt)
            // The deltas are so small that we aren't moving...
            return t;
        if (delta * origdelta < 0) {
            // We have reversed our path.
            int tag = (origt < t ? getTag(target, origt, t) : getTag(target, t, origt));
            if (tag != INSIDE)
                // Local minima found away from target - return the middle
                return (origt + t) / 2;
            // Local minima somewhere near target - move to target
            // and let the slope determine the resulting t.
            t = target;
        } else {
            t = newt;
        }
    }
}

From source file:darks.learning.word2vec.Word2Vec.java

/**
 * Calculate specify word's nearest or relate words
 * //from ww  w  .j a v a 2 s.  c o m
 * @param word Specify word
 * @param topCount Result size
 * @return Nearest or relate words
 */
public Set<WordEntry> distance(String word, int topCount) {
    int resultSize = FastMath.min(topCount, wordNodes.size());
    TreeSet<WordEntry> result = new TreeSet<WordEntry>();
    WordNode node = wordNodes.get(word);
    if (node != null) {
        double minSim = Double.MIN_VALUE;
        for (WordNode target : wordNodes.values()) {
            if (target.name.equals(word)) {
                continue;
            }
            double sim = target.feature.dot(node.feature);
            if (sim > minSim) {
                result.add(new WordEntry(target.name, sim));
                if (result.size() > resultSize) {
                    result.pollLast();
                }
                minSim = result.last().similar;
            }
        }
    }
    return result;
}

From source file:org.amanzi.neo.models.impl.network.NetworkModelTest.java

@Test
public void testCheckGetElement() throws ModelException {
    Envelope env = new Envelope(Double.MIN_EXPONENT, Double.MAX_EXPONENT, Double.MIN_NORMAL, Double.MAX_VALUE);
    List<Node> nodes = new ArrayList<Node>();
    Map<String, Object> properties = getProperties();
    properties.put(GEO_NODE_PROPERTIES.getLatitudeProperty(), Double.MIN_VALUE);
    properties.put(GEO_NODE_PROPERTIES.getLongitudeProperty(), Double.MAX_VALUE);
    Node mockedNode = getNodeMock(properties);
    nodes.add(mockedNode);//from  www . jav  a 2  s .c  o  m
    Double[] min = new Double[] { env.getMinY(), env.getMinX() };
    Double[] max = new Double[] { env.getMaxY(), env.getMaxX() };
    doReturn(nodes.iterator()).when(indexModel).getNodes(NetworkElementType.SITE, Double.class, min, max,
            GEO_NODE_PROPERTIES.getLatitudeProperty(), GEO_NODE_PROPERTIES.getLongitudeProperty());

}