当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.floor方法代码示例

本文整理汇总了Java中org.apache.commons.math3.util.FastMath.floor方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.floor方法的具体用法?Java FastMath.floor怎么用?Java FastMath.floor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.util.FastMath的用法示例。


在下文中一共展示了FastMath.floor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: estimate

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Estimation based on K<sup>th</sup> selection. This may be overridden
 * in specific enums to compute slightly different estimations.
 *
 * @param work array of numbers to be used for finding the percentile
 * @param pos indicated positional index prior computed from calling
 *            {@link #index(double, int)}
 * @param pivotsHeap an earlier populated cache if exists; will be used
 * @param length size of array considered
 * @param selector a {@link KthSelector} used for pivoting during search
 * @return estimated percentile
 */
protected double estimate(final double[] work, final int[] pivotsHeap,
                          final double pos, final int length,
                          final KthSelector selector) {

    final double fpos = FastMath.floor(pos);
    final int intPos = (int) fpos;
    final double dif = pos - fpos;

    if (pos < 1) {
        return selector.select(work, pivotsHeap, 0);
    }
    if (pos >= length) {
        return selector.select(work, pivotsHeap, length - 1);
    }

    final double lower = selector.select(work, pivotsHeap, intPos - 1);
    final double upper = selector.select(work, pivotsHeap, intPos);
    return lower + dif * (upper - lower);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:32,代码来源:Percentile.java

示例2: logGamma

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * <p>
 * Returns the value of log&nbsp;&Gamma;(x) for x&nbsp;&gt;&nbsp;0.
 * </p>
 * <p>
 * For x &le; 8, the implementation is based on the double precision
 * implementation in the <em>NSWC Library of Mathematics Subroutines</em>,
 * {@code DGAMLN}. For x &gt; 8, the implementation is based on
 * </p>
 * <ul>
 * <li><a href="http://mathworld.wolfram.com/GammaFunction.html">Gamma
 *     Function</a>, equation (28).</li>
 * <li><a href="http://mathworld.wolfram.com/LanczosApproximation.html">
 *     Lanczos Approximation</a>, equations (1) through (5).</li>
 * <li><a href="http://my.fit.edu/~gabdo/gamma.txt">Paul Godfrey, A note on
 *     the computation of the convergent Lanczos complex Gamma
 *     approximation</a></li>
 * </ul>
 *
 * @param x Argument.
 * @return the value of {@code log(Gamma(x))}, {@code Double.NaN} if
 * {@code x <= 0.0}.
 */
public static double logGamma(double x) {
    double ret;

    if (Double.isNaN(x) || (x <= 0.0)) {
        ret = Double.NaN;
    } else if (x < 0.5) {
        return logGamma1p(x) - FastMath.log(x);
    } else if (x <= 2.5) {
        return logGamma1p((x - 0.5) - 0.5);
    } else if (x <= 8.0) {
        final int n = (int) FastMath.floor(x - 1.5);
        double prod = 1.0;
        for (int i = 1; i <= n; i++) {
            prod *= x - i;
        }
        return logGamma1p(x - (n + 1)) + FastMath.log(prod);
    } else {
        double sum = lanczos(x);
        double tmp = x + LANCZOS_G + .5;
        ret = ((x + .5) * FastMath.log(tmp)) - tmp +
            HALF_LOG_2_PI + FastMath.log(sum / x);
    }

    return ret;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:49,代码来源:Gamma.java

示例3: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
 orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {
    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double[] lonlat=geotransform.getGeoFromPixel(xPos, yPos);
        double slantRange = getSlanteRange(lonlat[1], lonlat[0]);
      //  double sold=getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[1];
        double sampleDistRange= getPixelsize()[0];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage(),ex);
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:34,代码来源:Sentinel1.java

示例4: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}    

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {

    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);
    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:EnvisatImage.java

示例5: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
  public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
  	float prf=0;
  	if(isScanSar())
  		prf=NOMINAL_PRF; //Nominal PRF
else
	try {
		prf=prop.getPrf();
	} catch (Exception e) {
		logger.warn("Error reading PRF",e);
		prf=0;
	}
  	
   satelliteSpeed = calcSatelliteSpeed();

      double temp, deltaAzimuth, deltaRange;
      int[] output = new int[2];

      try {
      	// already in radian
          double incidenceAngle = getIncidence(xPos);
          double slantRange = ((CeosAlosProperties)prop).getSlantRange();

          double sampleDistAzim = getPixelsize()[0];
          double sampleDistRange =getPixelsize()[1];

          temp = (((CeosAlosProperties)prop).getWaveLength() * slantRange * prf) /
                  (2 * satelliteSpeed * (1 - FastMath.cos(ORBIT_INCLINATION) / REV_PER_DAY));

          //azimuth and delta in number of pixels
          deltaAzimuth = temp / sampleDistAzim;
          deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

          output[0] = (int) FastMath.floor(deltaAzimuth);
          output[1] = (int) FastMath.floor(deltaRange);
      } catch (Exception ex) {
      	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
      }
  	return output;
  }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:41,代码来源:GDALAlosCeos.java

示例6: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {

    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:36,代码来源:AbstractCosmoSkymedImage.java

示例7: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {
    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:TerrasarXImage.java

示例8: buildPolynomial

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Get the coefficients array for a given degree.
 * @param degree degree of the polynomial
 * @param coefficients list where the computed coefficients are stored
 * @param generator recurrence coefficients generator
 * @return coefficients array
 */
private static PolynomialFunction buildPolynomial(final int degree,
                                                  final List<BigFraction> coefficients,
                                                  final RecurrenceCoefficientsGenerator generator) {
    synchronized (coefficients) {
        final int maxDegree = (int) FastMath.floor(FastMath.sqrt(2 * coefficients.size())) - 1;
        if (degree > maxDegree) {
            computeUpToDegree(degree, maxDegree, generator, coefficients);
        }
    }

    // coefficient  for polynomial 0 is  l [0]
    // coefficients for polynomial 1 are l [1] ... l [2] (degrees 0 ... 1)
    // coefficients for polynomial 2 are l [3] ... l [5] (degrees 0 ... 2)
    // coefficients for polynomial 3 are l [6] ... l [9] (degrees 0 ... 3)
    // coefficients for polynomial 4 are l[10] ... l[14] (degrees 0 ... 4)
    // coefficients for polynomial 5 are l[15] ... l[20] (degrees 0 ... 5)
    // coefficients for polynomial 6 are l[21] ... l[27] (degrees 0 ... 6)
    // ...
    final int start = degree * (degree + 1) / 2;

    final double[] a = new double[degree + 1];
    for (int i = 0; i <= degree; ++i) {
        a[i] = coefficients.get(start + i).doubleValue();
    }

    // build the polynomial
    return new PolynomialFunction(a);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:PolynomialsUtils.java

示例9: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {
    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);


        if ((getSatellite()).equals("RADARSAT")) {
            String myImageType = getType();
            if (myImageType.equals("RSAT-1-SAR-SGF") || myImageType.equals("RSAT-1-SAR-SGX")) {
                output[1] = 20;	// This is really range displacement
            }
        }

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:43,代码来源:Radarsat2Image.java

示例10: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}    

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {

    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);
        
        
        if ((getSatellite()).equals("RADARSAT")) {
            String myImageType = getType();
            if (myImageType.equals("RSAT-1-SAR-SGF") || myImageType.equals("RSAT-1-SAR-SGX")) {
                output[1] = 20;	// This is really range displacement
            }
        }

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:44,代码来源:Radarsat1Image.java

示例11: readAndDecimateTile

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
public int[] readAndDecimateTile(int x, int y, int width, int height, double scalingFactor, boolean filter, int band) {
    int outWidth = (int) (width * scalingFactor);
    int outHeight = (int) (height * scalingFactor);
    double deltaPixelsX = (double) width / outWidth;
    double deltaPixelsY = (double) height / outHeight;
    double tileHeight = height / (((double) (width * height) / MAXTILESIZE));
    int[] outData = new int[outWidth * outHeight];
    if (height / outHeight > 4) {
        double a = width*1.0 / outWidth;  //moltiplico per 1.0 per avere un risultato con i decimali
        double b = height*1.0 / outHeight;
        for (int i = 0; i < outHeight; i++) {
            for (int j = 0; j < outWidth; j++) {
                try {
                    outData[i * outWidth + j] = readTile((int) (x + j * a), (int) (y + i * b), 1, 1,band)[0];
                    if(outData.length==0)
                    	outData[i * outWidth + j] = readTile((int) (x + j * a), (int) (y + i * b), 1, 1,band)[0];
                } catch (Exception e) {
                }
            }
        }
        return outData;
    }
    // load first tile
    int currentY = 0;
    int[] tile = readTile(0, currentY, width, (int) FastMath.ceil(tileHeight),band);
    double posY = 0.0;
    for (int j = 0; j < outHeight; j++, posY += deltaPixelsY) {
        // update progress bar
        if (j / 100 - FastMath.floor(j / 100) == 0) {
        }
        if (posY > (int) FastMath.ceil(tileHeight)) {
            tile = readTile(0, currentY + (int) FastMath.ceil(tileHeight), width, (int) FastMath.ceil(tileHeight),band);
            posY -= (int) FastMath.ceil(tileHeight);
            currentY += (int) FastMath.ceil(tileHeight);

        }

        double posX = 0.0;
        for (int i = 0; i < outWidth; i++, posX += deltaPixelsX) {
            //System.out.println("i = " + i + ", j = " + j + ", posX = " + posX + ", posY = " + posY);
            outData[i + j * outWidth] = tile[(int) posX * (int) posY];
        }
        //System.gc();
    }

    return outData;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:48,代码来源:SarImageReader.java

示例12: roundToNumberOfSignificantDigits

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Procedure rounds the given value to the given number of significant digits see
 * http://stackoverflow.com/questions/202302
 *
 * Note: The maximum double value in Java is on the order of 10^308, while the minimum value is on the order of
 * 10^-324. Therefore, you can run into trouble when applying the function roundToSignificantFigures to something
 * that's within a few powers of ten of Double.MIN_VALUE.
 *
 * Consequently, the variable magnitude may become Infinity, and it's all garbage from then on out. Fortunately,
 * this is not an insurmountable problem: it is only the factor magnitude that's overflowing. What really matters is
 * the product num * magnitude, and that does not overflow. One way of resolving this is by breaking up the
 * multiplication by the factor magintude into two steps.
 */
public static double roundToNumberOfSignificantDigits(double num, int n)
{
    final double maxPowerOfTen = FastMath.floor(FastMath.log10(Double.MAX_VALUE));

    if (num == 0)
    {
        return 0;
    }

    try
    {
        return new BigDecimal(num).round(new MathContext(n, RoundingMode.HALF_EVEN)).doubleValue();
    }
    catch (ArithmeticException ex)
    {
        // nothing to do
    }

    final double d = FastMath.ceil(FastMath.log10(num < 0 ? -num : num));
    final int power = n - (int) d;

    double firstMagnitudeFactor = 1.0;
    double secondMagnitudeFactor = 1.0;
    if (power > maxPowerOfTen)
    {
        firstMagnitudeFactor = FastMath.pow(10.0, maxPowerOfTen);
        secondMagnitudeFactor = FastMath.pow(10.0, (double) power - maxPowerOfTen);
    }
    else
    {
        firstMagnitudeFactor = FastMath.pow(10.0, (double) power);
    }

    double toBeRounded = num * firstMagnitudeFactor;
    toBeRounded *= secondMagnitudeFactor;

    final long shifted = FastMath.round(toBeRounded);
    double rounded = ((double) shifted) / firstMagnitudeFactor;
    rounded /= secondMagnitudeFactor;
    return rounded;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:55,代码来源:ViewUtils.java

示例13: selectReaction

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * from the selected group, a reaction is chosen randomly/uniformly a random
 * number between 0 and the group's max propensity is then chosen if this
 * number is not less than the chosen reaction's propensity, the reaction is
 * rejected and the process is repeated until success occurs
 * 
 * @param selectedGroup
 *            the group to choose a reaction from
 * @param r3
 * @param r4
 * @return the chosen reaction's ID
 */
private String selectReaction(int selectedGroup, double r3, double r4)
{

	HashSet<String> reactionSet = groupToReactionSetList.get(selectedGroup);

	double randomIndex = FastMath.floor(r3 * reactionSet.size());
	int indexIter = 0;
	Iterator<String> reactionSetIterator = reactionSet.iterator();

	while (reactionSetIterator.hasNext() && indexIter < randomIndex)
	{

		reactionSetIterator.next();
		++indexIter;
	}

	String selectedReactionID = reactionSetIterator.next();
	double reactionPropensity = reactionToPropensityMap.get(selectedReactionID);

	// this is choosing a value between 0 and the max propensity in the
	// group
	double randomPropensity = r4 * groupToMaxValueMap.get(selectedGroup);

	// loop until there's no reaction rejection
	// if the random propensity is higher than the selected reaction's
	// propensity, another random reaction is chosen
	while (randomPropensity > reactionPropensity)
	{

		r3 = randomNumberGenerator.nextDouble();
		r4 = randomNumberGenerator.nextDouble();

		randomIndex = (int) FastMath.floor(r3 * reactionSet.size());
		indexIter = 0;
		reactionSetIterator = reactionSet.iterator();

		while (reactionSetIterator.hasNext() && (indexIter < randomIndex))
		{

			reactionSetIterator.next();
			++indexIter;
		}

		selectedReactionID = reactionSetIterator.next();
		reactionPropensity = reactionToPropensityMap.get(selectedReactionID);
		randomPropensity = r4 * groupToMaxValueMap.get(selectedGroup);
	}

	return selectedReactionID;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:63,代码来源:SimulatorSSACR.java

示例14: handleStep

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Handle the last accepted step
 * @param interpolator interpolator for the last accepted step. For
 * efficiency purposes, the various integrators reuse the same
 * object on each call, so if the instance wants to keep it across
 * all calls (for example to provide at the end of the integration a
 * continuous model valid throughout the integration range), it
 * should build a local copy using the clone method and store this
 * copy.
 * @param isLast true if the step is the last one
 * @exception MaxCountExceededException if the interpolator throws one because
 * the number of functions evaluations is exceeded
 */
public void handleStep(final StepInterpolator interpolator, final boolean isLast)
    throws MaxCountExceededException {
    // The first time, update the last state with the start information.
    if (lastState == null) {
        firstTime = interpolator.getPreviousTime();
        lastTime = interpolator.getPreviousTime();
        interpolator.setInterpolatedTime(lastTime);
        lastState = interpolator.getInterpolatedState().clone();
        lastDerivatives = interpolator.getInterpolatedDerivatives().clone();

        // Take the integration direction into account.
        forward = interpolator.getCurrentTime() >= lastTime;
        if (!forward) {
            h = -h;
        }
    }

    // Calculate next normalized step time.
    double nextTime = (mode == StepNormalizerMode.INCREMENT) ?
                      lastTime + h :
                      (FastMath.floor(lastTime / h) + 1) * h;
    if (mode == StepNormalizerMode.MULTIPLES &&
        Precision.equals(nextTime, lastTime, 1)) {
        nextTime += h;
    }

    // Process normalized steps as long as they are in the current step.
    boolean nextInStep = isNextInStep(nextTime, interpolator);
    while (nextInStep) {
        // Output the stored previous step.
        doNormalizedStep(false);

        // Store the next step as last step.
        storeStep(interpolator, nextTime);

        // Move on to the next step.
        nextTime += h;
        nextInStep = isNextInStep(nextTime, interpolator);
    }

    if (isLast) {
        // There will be no more steps. The stored one should be given to
        // the handler. We may have to output one more step. Only the last
        // one of those should be flagged as being the last.
        boolean addLast = bounds.lastIncluded() &&
                          lastTime != interpolator.getCurrentTime();
        doNormalizedStep(!addLast);
        if (addLast) {
            storeStep(interpolator, interpolator.getCurrentTime());
            doNormalizedStep(true);
        }
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:67,代码来源:StepNormalizer.java

示例15: value

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.floor(x);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:5,代码来源:Floor.java


注:本文中的org.apache.commons.math3.util.FastMath.floor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。