List of usage examples for java.lang Double POSITIVE_INFINITY
double POSITIVE_INFINITY
To view the source code for java.lang Double POSITIVE_INFINITY.
Click Source Link
From source file:fr.inria.oak.paxquery.pact.operations.aggregation.Min.java
public Min(MetadataTypes type) { this.type = type; switch (this.type) { case STRING_TYPE: this.minDouble = Double.POSITIVE_INFINITY; break;//from w w w .j ava2 s . co m default: logger.error("Min aggregation not supported for this data type!"); } this.count = 0; }
From source file:com.joptimizer.util.MPSParserTest.java
/** * This is the AFIRO netlib problem.//from w ww.j a va 2 s . c om */ public void testMps1() throws Exception { log.debug("testMps1"); String problemId = "1"; File f = Utils .getClasspathResourceAsFile("lp" + File.separator + "mps" + File.separator + problemId + ".mps"); double unspecifiedLBValue = 0; double unspecifiedUBValue = 99999; double unboundedLBValue = MPSParser.DEFAULT_UNBOUNDED_LOWER_BOUND; double unboundedUBValue = Double.POSITIVE_INFINITY; MPSParser p = new MPSParser(unspecifiedLBValue, unspecifiedUBValue, unboundedLBValue, unboundedUBValue); p.parse(f); int n = p.getN(); int meq = p.getMeq(); int mieq = p.getMieq(); log.debug("name: " + p.getName()); log.debug("n : " + n); log.debug("meq : " + meq); log.debug("mieq: " + mieq); log.debug("rows: " + (meq + mieq)); log.debug("nz: " + (p.getNzG() + p.getNzA())); // log.debug("c : " + ArrayUtils.toString(p.getC().toArray())); // log.debug("G : " + ArrayUtils.toString(p.getG().toArray())); // log.debug("h : " + ArrayUtils.toString(p.getH().toArray())); // log.debug("A : " + ArrayUtils.toString(p.getA().toArray())); // log.debug("b : " + ArrayUtils.toString(p.getB().toArray())); log.debug("lb : " + ArrayUtils.toString(p.getLb().toArray())); log.debug("ub : " + ArrayUtils.toString(p.getUb().toArray())); assertEquals(n, 32); assertEquals(meq, 8); assertEquals(mieq, 19); //all the lower bound are not explicit in this mps model for (int i = 0; i < n; i++) { assertEquals(unspecifiedLBValue, p.getLb().getQuick(i)); } //all the upper bound are not explicit in this mps model for (int i = 0; i < n; i++) { assertEquals(unspecifiedUBValue, p.getUb().getQuick(i)); } }
From source file:etomica.potential.P2HSDipole.java
public P2HSDipole(ISpace space, double sigma, double dipole) { this(space, 1, dipole, Double.POSITIVE_INFINITY); }
From source file:com.rapidminer.gui.plotter.charts.ColorizedBarRenderer.java
public ColorizedBarRenderer(double[] colorValues) { this.colorValues = colorValues; this.minColor = Double.POSITIVE_INFINITY; this.maxColor = Double.NEGATIVE_INFINITY; if (this.colorValues != null) { for (double d : this.colorValues) { this.minColor = MathFunctions.robustMin(this.minColor, d); this.maxColor = MathFunctions.robustMax(this.maxColor, d); }//from w w w . j a v a 2 s . c o m } }
From source file:jtrace.object.Sphere.java
@Override public double getFirstCollisionObjectFrame(Ray ray) { Vector3D displacement = ray.getOrigin(); double a = ray.getDirection().getNormSq(); double b = 2.0 * ray.getDirection().dotProduct(displacement); double c = displacement.getNormSq() - 1.0; // Check for miss: if (b * b < 4.0 * a * c) return Double.POSITIVE_INFINITY; // Determine actual intersections double alpha0 = -0.5 * b / a; double dalpha = 0.5 * Math.sqrt(b * b - 4.0 * a * c) / a; double alphaPlus = alpha0 + dalpha; double alphaMinus = alpha0 - dalpha; // Abort if no intersections in front of us if (alphaMinus < 0 && alphaPlus < 0) return Double.POSITIVE_INFINITY; // Find closest intersection in front of us double alpha; if (alphaMinus < alphaPlus && alphaMinus > 0) alpha = alphaMinus;/*from w ww . ja v a 2s . c o m*/ else alpha = alphaPlus; // Record incident and normal rays incidentRay = ray; Vector3D collisionLocation = ray.direction.scalarMultiply(alpha).add(ray.origin); Vector3D normal = collisionLocation.normalize(); normalRay = new Ray(collisionLocation, normal); return alpha; }
From source file:com.rapidminer.gui.plotter.charts.ColorizedBubbleRenderer.java
public ColorizedBubbleRenderer(double[] colors) { super(XYBubbleRenderer.SCALE_ON_RANGE_AXIS); this.minColor = Double.POSITIVE_INFINITY; this.maxColor = Double.NEGATIVE_INFINITY; for (double c : colors) { minColor = MathFunctions.robustMin(minColor, c); maxColor = MathFunctions.robustMax(maxColor, c); }//from w w w.j av a 2s. c om this.colors = colors; }
From source file:mase.app.multirover.MultiRoverIndEval.java
@Override protected void evaluate(MasonSimState sim) { MultiRover mr = (MultiRover) sim;//from w w w. j a v a2s . c o m for (int i = 0; i < mr.rovers.size(); i++) { Rover r = mr.rovers.get(i); // Distance to closest rock double min = Double.POSITIVE_INFINITY; for (Rock rock : mr.rocks) { min = Math.min(min, r.distanceTo(rock)); } distanceToRock[i] += min; // Distance to closest rover min = Double.POSITIVE_INFINITY; for (Rover other : mr.rovers) { if (r != other) { min = Math.min(min, r.distanceTo(other)); } } distanceToNeighbor[i] += min; // Amount of time each actuator was active for (int a = 0; a < actuatorTime.length; a++) { if (r.getActuatorType() == a) { actuatorTime[i][a]++; } } } }
From source file:dr.inference.model.IndianBuffetProcessPrior.java
public IndianBuffetProcessPrior(Parameter alpha, Parameter beta, AdaptableSizeFastMatrixParameter data) { super(null);/*from w w w . j av a2 s . c o m*/ this.alpha = alpha; alpha.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0, 1)); addVariable(alpha); this.beta = beta; beta.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0, 1)); addVariable(beta); this.data = data; addVariable(data); for (int i = 0; i < data.getRowDimension(); i++) { if (data.getParameterValue(i, 0) != 0) containsNonZeroElements[0] = true; } for (int i = 0; i < data.getColumnDimension(); i++) { for (int j = 0; j < data.getRowDimension(); j++) { rowCount[i] += Math.abs(data.getParameterValue(j, i)); } } ncols = data.getColumnDimension(); }
From source file:Main.java
/** * Fills the array with random doubles. Values will be between min (inclusive) and * max (inclusive)./*w w w.j a va2 s . c om*/ */ public static void genRandomDoubles(long seed, double min, double max, double array[], boolean includeExtremes) { Random r = new Random(seed); int minExponent = Math.min(Math.getExponent(min), 0); int maxExponent = Math.max(Math.getExponent(max), 0); if (minExponent < -6 || maxExponent > 6) { // Use an exponential distribution int exponentDiff = maxExponent - minExponent; for (int i = 0; i < array.length; i++) { double mantissa = r.nextDouble(); int exponent = minExponent + r.nextInt(maxExponent - minExponent); int sign = (min >= 0) ? 1 : 1 - r.nextInt(2) * 2; // -1 or 1 double rand = sign * mantissa * Math.pow(2.0, exponent); if (rand < min || rand > max) { continue; } array[i] = rand; } } else { // Use a linear distribution for (int i = 0; i < array.length; i++) { double rand = r.nextDouble(); array[i] = min + rand * (max - min); } } // Seed a few special numbers we want to be sure to test. for (int i = 0; i < sInterestingDoubles.length; i++) { double d = sInterestingDoubles[i]; if (min <= d && d <= max) { array[r.nextInt(array.length)] = d; } } array[r.nextInt(array.length)] = min; array[r.nextInt(array.length)] = max; if (includeExtremes) { array[r.nextInt(array.length)] = Double.NaN; array[r.nextInt(array.length)] = Double.POSITIVE_INFINITY; array[r.nextInt(array.length)] = Double.NEGATIVE_INFINITY; array[r.nextInt(array.length)] = Double.MIN_VALUE; array[r.nextInt(array.length)] = Double.MIN_NORMAL; array[r.nextInt(array.length)] = Double.MAX_VALUE; array[r.nextInt(array.length)] = -Double.MIN_VALUE; array[r.nextInt(array.length)] = -Double.MIN_NORMAL; array[r.nextInt(array.length)] = -Double.MAX_VALUE; } }
From source file:jtrace.object.Plane.java
@Override public double getFirstCollisionObjectFrame(Ray ray) { double alpha = planeNormal.dotProduct(Vector3D.ZERO.subtract(ray.origin)) / planeNormal.dotProduct(ray.direction); if (alpha < 0) return Double.POSITIVE_INFINITY; incidentRay = ray;//www . j ava2s . c o m Vector3D collisionLocation = ray.origin.add(alpha, ray.direction); normalRay = new Ray(collisionLocation, planeNormal); Vector3D q = collisionLocation; u = q.dotProduct(planeNorth); v = q.dotProduct(planeEast); return alpha; }