Example usage for java.lang Double POSITIVE_INFINITY

List of usage examples for java.lang Double POSITIVE_INFINITY

Introduction

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

Prototype

double POSITIVE_INFINITY

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

Click Source Link

Document

A constant holding the positive infinity of type double .

Usage

From source file:jasima.core.random.continuous.DblNormal.java

@Override
public Pair<Double, Double> getValueRange() {
    return new Pair<>(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
}

From source file:jeans.math.SingleStat.java

public void reset() {
    m_Sum = 0.0;/*from  w w  w  .  j  a v  a 2s . co m*/
    m_SumSQ = 0.0;
    m_Count = 0.0;
    m_Min = Double.POSITIVE_INFINITY;
    m_Max = Double.NEGATIVE_INFINITY;
    //      m_Distribution = null;
}

From source file:mase.spec.SilhouetteDistanceCalculator.java

@Override
public double[][] computeDistances(List<BehaviourResult>[] list, EvolutionState state) {
    List<BehaviourResult> all = new ArrayList<>();
    int[][] alloc = new int[list.length][];
    int index = 0;

    for (int i = 0; i < list.length; i++) {
        alloc[i] = new int[list[i].size()];
        all.addAll(list[i]);//from   ww w.j a  v a2s  . c om
        for (int j = 0; j < list[i].size(); j++) {
            alloc[i][j] = index++;
        }
    }

    RealMatrix behavDist = null;
    if (!all.isEmpty()) {
        if (executor != null) {
            behavDist = computeDistanceMatrixParallel(all);
        } else {
            behavDist = computeDistanceMatrix(all);
        }
    }

    double[][] mpDist = new double[list.length][list.length];
    for (int i = 0; i < mpDist.length; i++) {
        for (int j = 0; j < mpDist.length; j++) {
            if (i == j) {
                mpDist[i][j] = Double.NaN;
            } else if (list[i].isEmpty() || list[j].isEmpty()) {
                mpDist[i][j] = Double.POSITIVE_INFINITY;
            } else if (i < j) {
                double wi = silhouetteWidth(alloc[i], alloc[j], behavDist, state);
                double wj = silhouetteWidth(alloc[j], alloc[i], behavDist, state);
                mpDist[i][j] = (wi + wj) / 2;
            } else {
                mpDist[i][j] = mpDist[j][i];
            }
        }
    }
    return mpDist;
}

From source file:beast.inference.distribution.GammaDistributionModel.java

/**
 * Construct a constant mutation rate model.
 *//*from www.  j  ava 2s. c  om*/
public GammaDistributionModel(Variable<Double> shape) {

    super(GAMMA_DISTRIBUTION_MODEL);

    this.shape = shape;
    addVariable(shape);
    shape.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1));
}

From source file:nars.util.meter.event.PeriodMeter.java

protected double f(double period) {
    if (frequency) {
        if (period == 0)
            return Double.POSITIVE_INFINITY;
        return 1.0 / period;
    }//from ww w  . j  a  v a2  s.c  o m
    return period;
}

From source file:bide.hpd.TraceDistribution.java

/**
 * Analyze trace/*from w w w.jav a 2s .  co  m*/
 * @param hpdValue TODO
 */
private void analyseDistribution(double[] values, double hpdValue, double burnin) {

    int start = (int) (values.length * burnin);
    values = ArrayUtils.subarray(values, start, values.length);
    //      mean = DiscreteStatistics.mean(values);
    mean = StatUtils.mean(values);
    minimum = Double.POSITIVE_INFINITY;
    maximum = Double.NEGATIVE_INFINITY;

    for (int i = 0; i < values.length; i++) {
        if (values[i] < minimum)
            minimum = values[i];
        if (values[i] > maximum)
            maximum = values[i];
    }

    if (maximum == minimum) {
        isValid = false;
        return;
    }

    int[] indices = new int[values.length];
    HeapSort.sort(values, indices);
    median = statQuantile(0.5, values, indices);
    cpdLower = statQuantile(0.025, values, indices);
    cpdUpper = statQuantile(0.975, values, indices);
    calculateHPDInterval(hpdValue, values, indices);

    isValid = true;
}

From source file:edu.oregonstate.eecs.mcplan.bandit.HeuristicBandit.java

@Override
protected final int selectArm(final RandomGenerator rng) {
    int istar = 0;
    double hstar = Double.NEGATIVE_INFINITY;
    for (int i = 0; i < Narms(); ++i) {
        final double h = heuristic(i);
        if (h > hstar) {
            hstar = h;//from   ww w  .j a v  a  2s.co m
            istar = i;
        }
        if (h == Double.POSITIVE_INFINITY) {
            // Since POSITIVE_INFINITY > POSITIVE_INFINITY is false, no
            // other arm can replace istar in the future.
            break;
        }
    }
    return istar;
}

From source file:statistic.graph.XYChart.java

private void initXAxis(String label) {
    plot.setDomainAxis(new NumberAxis(label));
    double max = Double.NEGATIVE_INFINITY;
    double min = Double.POSITIVE_INFINITY;
    for (int s = 0; s < collection.getSeriesCount(); s++) {
        for (int d = 0; d < collection.getItemCount(s); d++) {
            XYDataItem data = collection.getSeries(s).getDataItem(d);
            if (data.getX().longValue() == Integer.MAX_VALUE || data.getX().longValue() == Integer.MIN_VALUE) {
                continue;
            }/*from  www .  ja  v a 2  s  . c o  m*/
            if (data.getX().doubleValue() > max) {
                max = data.getX().doubleValue();
            }
            if (data.getX().doubleValue() < min) {
                min = data.getX().doubleValue();
            }
        }
    }
    plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getDomainAxis().setRange(min - 0.5, max + 0.5);
}

From source file:geogebra.kernel.AlgoBinomial.java

private double Binom(double n, double r) {
    double INFINITY = Double.POSITIVE_INFINITY;
    try {//w w w  . jav a 2  s .  co  m
        if (n == 0d && r == 0d)
            return 1d;
        if (r > n / 2)
            r = n - r;
        if (n < 1d || r < 0d || n < r)
            return 0d;
        if (Math.floor(n) != n || Math.floor(r) != r)
            return 0d;

        double ncr = BinomLog(n, r);
        if (ncr == INFINITY)
            return INFINITY; // check to stop needless slow calculations

        // BinomLog is not exact for some values
        // (determined by trial and error)
        if (n <= 37)
            return ncr;
        //if (r<2.8+Math.exp((250-n)/100) && n<59000) return ncr;

        // BinomBig is more accurate but slower
        // (but cannot be exact if the answer has more than about 16 significant digits)
        return BinomBig(n, r);
    } catch (Exception e) {
        return INFINITY;
    }

}

From source file:com.inform.jamps.solver.gurobi.GurobiVariable.java

protected GurobiVariable(final GurobiProgram program, final String name, final VariableType type) {
    if (program == null) {
        throw new IllegalArgumentException("Parameter program is mandatory and may not be null");
    }/*from   ww w. j  a v a  2s. c o  m*/
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is mandatory and may not be null");
    }
    if (type == null) {
        throw new IllegalArgumentException("Parameter type is mandatory and may not be null");
    }

    this.program = program;
    this.name = name;
    this.type = type;

    if (type == VariableType.BINARY) {
        lowerBound = 0.0;
        upperBound = 1.0;
    } else {
        lowerBound = Double.NEGATIVE_INFINITY;
        upperBound = Double.POSITIVE_INFINITY;
    }
}