public void testMin_noArgs() { try { Doubles.min(); fail(); } catch (IllegalArgumentException expected) { } }
public void testMin() { assertEquals(LEAST, Doubles.min(LEAST)); assertEquals(GREATEST, Doubles.min(GREATEST)); assertEquals( (double) 0, Doubles.min( (double) 8, (double) 6, (double) 7, (double) 5, (double) 3, (double) 0, (double) 9)); assertEquals(-0.0, Doubles.min(-0.0, 0.0)); assertEquals(-0.0, Doubles.min(0.0, -0.0)); assertEquals(LEAST, Doubles.min(NUMBERS)); assertTrue(Double.isNaN(Doubles.min(VALUES))); }
private static double computeSmallestSingularValue(DenseMatrix64F A) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows, A.numCols, false, false, true); svd.decompose(A); double[] singularValues = svd.getSingularValues(); return Doubles.min(singularValues); } }
private static double computeSmallestSingularValue(DenseMatrix64F A) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows, A.numCols, false, false, true); svd.decompose(A); double[] singularValues = svd.getSingularValues(); return Doubles.min(singularValues); } }
public void testMin_noArgs() { try { Doubles.min(); fail(); } catch (IllegalArgumentException expected) { } }
public void testMin() { assertEquals(LEAST, Doubles.min(LEAST)); assertEquals(GREATEST, Doubles.min(GREATEST)); assertEquals((double) 0, Doubles.min( (double) 8, (double) 6, (double) 7, (double) 5, (double) 3, (double) 0, (double) 9)); assertEquals(-0.0, Doubles.min(-0.0, 0.0)); assertEquals(-0.0, Doubles.min(0.0, -0.0)); assertEquals(LEAST, Doubles.min(NUMBERS)); assertTrue(Double.isNaN(Doubles.min(VALUES))); }
/** * Calculates the price of the bond future product. * <p> * The price of the product is the price on the valuation date. * <p> * Strata uses <i>decimal prices</i> for bond futures. This is coherent with the pricing of {@link FixedCouponBond}. * For example, a price of 99.32% is represented in Strata by 0.9932. * * @param future the future * @param discountingProvider the discounting provider * @return the price of the product, in decimal form */ public double price(ResolvedBondFuture future, LegalEntityDiscountingProvider discountingProvider) { ImmutableList<ResolvedFixedCouponBond> basket = future.getDeliveryBasket(); int size = basket.size(); double[] priceBonds = new double[size]; for (int i = 0; i < size; ++i) { ResolvedFixedCouponBond bond = basket.get(i); double dirtyPrice = bondPricer.dirtyPriceFromCurves(bond, discountingProvider, future.getLastDeliveryDate()); priceBonds[i] = bondPricer.cleanPriceFromDirtyPrice( bond, future.getLastDeliveryDate(), dirtyPrice) / future.getConversionFactors().get(i); } return Doubles.min(priceBonds); }
bond, future.getLastDeliveryDate(), dirtyPrice) / future.getConversionFactors().get(i); return Doubles.min(priceBonds);
public void setBounds( LatLonGeo center, DoubleUnaryOperator unitsToSu, double ewExtent_UNITS, double nsExtent_UNITS ) { double ewExtent_SU = unitsToSu.applyAsDouble( ewExtent_UNITS ); double nsExtent_SU = unitsToSu.applyAsDouble( nsExtent_UNITS ); LatLonGeo[] latlons = { center.displacedBy( 0.5*ewExtent_SU, Azimuth.fromNavDeg( -90 ) ), center.displacedBy( 0.5*ewExtent_SU, Azimuth.fromNavDeg( +90 ) ), center.displacedBy( 0.5*nsExtent_SU, Azimuth.fromNavDeg( 0 ) ), center.displacedBy( 0.5*nsExtent_SU, Azimuth.fromNavDeg( 180 ) ) }; double[] xs_SU = new double[ latlons.length ]; double[] ys_SU = new double[ latlons.length ]; for ( int i = 0; i < latlons.length; i++ ) { Vector2d xy_SU = proj.project( latlons[ i ] ); xs_SU[ i ] = xy_SU.getX( ); ys_SU[ i ] = xy_SU.getY( ); } this.axis.set( min( xs_SU ), max( xs_SU ), min( ys_SU ), max( ys_SU ) ); }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Context<EvaluatorContext>> functionCall ) { ClusterEvaluator[] evaluators = functionCall.getContext().payload.evaluators; double[] results = functionCall.getContext().payload.results; for( int i = 0; i < evaluators.length; i++ ) results[ i ] = evaluators[ i ].evaluate( functionCall.getArguments() ); LOG.debug( "results: {}", results ); // calc min distance double min = Doubles.min( results ); int index = Doubles.indexOf( results, min ); String category = evaluators[ index ].getTargetCategory(); LOG.debug( "category: {}", category ); // emit distance, and intermediate cluster category scores if( !getSpec().getModelSchema().isIncludePredictedCategories() ) { functionCall.getOutputCollector().add( functionCall.getContext().result( category ) ); return; } Tuple result = functionCall.getContext().tuple; result.set( 0, category ); for( int i = 0; i < results.length; i++ ) result.set( i + 1, results[ i ] ); functionCall.getOutputCollector().add( result ); } }
final long maxWidthPerQuery = plannerSettings.getOptions().getOption(ExecConstants.MAX_WIDTH_GLOBAL); final long sliceTarget = plannerSettings.getSliceTarget(); final double minFactor = Doubles.min(leftRowCount * 1.0 / sliceTarget, numEndPoints * maxWidthPerNode, maxWidthPerQuery); final boolean enableBroadCast = (minFactor * broadcastFactor < leftRowCount); logger.debug("Enable broadcast plan? %s minFactor %d (numEndPoints %d, maxWidthPerNode %d, rightRowCount %d, broadcastFactor %d, leftRowCount %d, sliceTarget %d, maxWidthPerQuery %d)",