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


Java UnivariateInterpolator类代码示例

本文整理汇总了Java中org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator的典型用法代码示例。如果您正苦于以下问题:Java UnivariateInterpolator类的具体用法?Java UnivariateInterpolator怎么用?Java UnivariateInterpolator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnivariateInterpolator类属于org.apache.commons.math3.analysis.interpolation包,在下文中一共展示了UnivariateInterpolator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cubicBSplineInterpolation

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
public IDecimalAggregate<E> cubicBSplineInterpolation(final InterpolationConfig config) {
    if (values.isEmpty()) {
        return DummyDecimalAggregate.getInstance();
    }

    if (values.size() < 4) {
        return parent;
    }

    final Pair<List<Double>, List<Double>> pair = fillInterpolationPoints(config, null);
    final List<Double> xval = pair.getFirst();
    final List<Double> yval = pair.getSecond();

    final ControlPath cp = new ControlPath();
    for (int i = 0; i < xval.size(); i++) {
        cp.addPoint(PointFactory.create(xval.get(i), yval.get(i)));
    }
    final GroupIterator gi = new GroupIterator("0:n-1", cp.numPoints());
    final CubicBSpline curve = new CubicBSpline(cp, gi);
    curve.setInterpolateEndpoints(true);
    calculateCurve(xval, yval, curve);

    final UnivariateInterpolator interpolator = new SplineInterpolator();
    return interpolate(config, xval, yval, interpolator);
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:26,代码来源:DecimalAggregateInterpolations.java

示例2: bezierCurveInterpolation

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
public IDecimalAggregate<E> bezierCurveInterpolation(final InterpolationConfig config) {
    if (values.isEmpty()) {
        return DummyDecimalAggregate.getInstance();
    }

    final Pair<List<Double>, List<Double>> pair = fillInterpolationPoints(config, BEZIER_CURVE_MAX_SIZE);
    final List<Double> xval = pair.getFirst();
    final List<Double> yval = pair.getSecond();

    final ControlPath cp = new ControlPath();
    for (int i = 0; i < xval.size(); i++) {
        cp.addPoint(PointFactory.create(xval.get(i), yval.get(i)));
    }
    final GroupIterator gi = new GroupIterator("0:n-1", cp.numPoints());
    final BezierCurve curve = new BezierCurve(cp, gi);
    calculateCurve(xval, yval, curve);

    final UnivariateInterpolator interpolator = new SplineInterpolator();
    return interpolate(config, xval, yval, interpolator);
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:21,代码来源:DecimalAggregateInterpolations.java

示例3: bSplineInterpolation

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
public IDecimalAggregate<E> bSplineInterpolation(final BSplineInterpolationConfig config) {
    if (values.isEmpty()) {
        return DummyDecimalAggregate.getInstance();
    }

    final Pair<List<Double>, List<Double>> pair = fillInterpolationPoints(config, null);
    final List<Double> xval = pair.getFirst();
    final List<Double> yval = pair.getSecond();

    final ControlPath cp = new ControlPath();
    for (int i = 0; i < xval.size(); i++) {
        cp.addPoint(PointFactory.create(xval.get(i), yval.get(i)));
    }
    final GroupIterator gi = new GroupIterator("0:n-1", cp.numPoints());
    final BSpline curve = new BSpline(cp, gi);
    curve.setDegree(config.getDegree());
    final int maxDegree = cp.numPoints() - 1;
    if (curve.getDegree() > maxDegree) {
        curve.setDegree(maxDegree);
    }
    calculateCurve(xval, yval, curve);

    final UnivariateInterpolator interpolator = new SplineInterpolator();
    return interpolate(config, xval, yval, interpolator);
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:26,代码来源:DecimalAggregateInterpolations.java

示例4: loessInterpolation

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
public IDecimalAggregate<E> loessInterpolation(final LoessInterpolationConfig config) {
    if (values.isEmpty()) {
        return DummyDecimalAggregate.getInstance();
    }

    if (values.size() < 3) {
        return parent;
    }

    final Pair<List<Double>, List<Double>> pair = fillInterpolationPoints(config, null);
    final List<Double> xval = pair.getFirst();
    final List<Double> yval = pair.getSecond();
    double bandwidth = config.getSmoothness().getValue(PercentScale.RATE).doubleValue();
    if (bandwidth * values.size() < 2) {
        bandwidth = Decimal.TWO.divide(values.size()).doubleValue();
    }
    final UnivariateInterpolator interpolator = new LoessInterpolator(bandwidth,
            LoessInterpolator.DEFAULT_ROBUSTNESS_ITERS);
    return interpolate(config, xval, yval, interpolator);
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:21,代码来源:DecimalAggregateInterpolations.java

示例5: createInterpolator

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
private UnivariateInterpolator createInterpolator()
{	
switch(this.gcDepthInterpolation)
	{
	case loess: return new LoessInterpolator(0.5,4);
	case neville: return new NevilleInterpolator();
	case difference  : return new DividedDifferenceInterpolator();
	case linear: return new LinearInterpolator();
	case spline : return new SplineInterpolator();
	case identity : return new UnivariateInterpolator()
			{
			@Override
			public UnivariateFunction interpolate(double[] arg0, double[] arg1)
					throws MathIllegalArgumentException, DimensionMismatchException {
				return new Identity();
				}
			};
	default: throw new IllegalStateException("Not implemented");
	}
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:21,代码来源:CopyNumber01.java

示例6: interpolate

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
private IDecimalAggregate<E> interpolate(final InterpolationConfig config, final List<Double> xval,
        final List<Double> yval, final UnivariateInterpolator interpolator) {
    final UnivariateFunction interpolated = interpolator.interpolate(Doubles.toArray(xval), Doubles.toArray(yval));
    final List<E> interpolatedValues = new ArrayList<E>();
    interpolateAndMaybeReverseMultiplier(config, interpolated, interpolatedValues);
    Assertions.assertThat(interpolatedValues).hasSameSizeAs(values);
    return new DecimalAggregate<E>(interpolatedValues, converter);
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:9,代码来源:DecimalAggregateInterpolations.java

示例7: FromFileTimeseriesParameter

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
/**
  * Create a {@link FromFileTimeseriesParameter} object using the specified
  * file.<br><br>
  * 
  * See also {@link FromFileTimeseriesParameter} and {@link Parameter}.
  * 
  * @param filename
  *        The name of the file from which to read timeseries data.
  * @param parameterName
  *        The name of the resulting {@link Parameter}. It is acceptable
  *        for this argument to be the empty string.
  * @param interpolator
  *        An instance of a {@link UnivariateInterpolator}. This interpolator
  *        is used to convert timeseries keypoints into a queryable function
  *        {@code f(T)} for all {@code T} in the domain of the interpolation
  *        keys. Possible examples, among others, include the {@link SplineInterpolator}
  *        and the {@link LinearInterpolator}.
  * 
  * @throws IOException
  *         This method raises {@link IOException} if, for any reason, the stated
  *         file cannot be processed. Reasons for such failure include: (a) the
  *         file does not exist; (b) the file is inaccessible to the read stream;
  *         (c) the file does not contain any data or contains fewer than two 
  *         records; (d) the file exists and can be accessed but does not have
  *         the required format. See {@link FromFileTimeseriesParameter}.
  */
@Inject
public FromFileTimeseriesParameter(
@Named("FROM_FILE_TIMESERIES_PARAMETER_FILENAME")
   final String filename,
@Named("FROM_FILE_TIMESERIES_PARAMETER_NAME")
   final String parameterName,
@Named("FROM_FILE_TIMESERIES_PARAMETER_INTERPOLATOR")
   final UnivariateInterpolator interpolator
   ) throws IOException {
   super(parameterName);
   Preconditions.checkNotNull(filename);
   final BufferedReader
      reader = new BufferedReader(new FileReader(filename));
   String
      line = null;
   final List<Double>
      x = new ArrayList<Double>(),
      y = new ArrayList<Double>();
   int
      numInterpolationPoints = 0;
   try {
      while((line = reader.readLine()) != null) {
         if(line.isEmpty()) continue;
         final String[]
            entries = line.split("[\\s:;,\t]+");
         if(entries.length != 2)
            throw new IOException(
               getClass().getSimpleName() + ": serialized timeseries are expected to "
             + "consist of exactly two data columns. The input data: " + entries + " does "
             + "not conform to this template. The data in file " + filename + " could not "
             + "be parsed."
             );
         x.add(Double.parseDouble(entries[0]));
         y.add(Double.parseDouble(entries[1]));
         ++numInterpolationPoints;
      }
   }
   catch(final NumberFormatException e) {
      throw new IOException(e.getMessage());
   }
   finally {
      reader.close();
   }
   
   if(numInterpolationPoints <= 1)
      throw new IllegalArgumentException(
         getClass().getSimpleName() + ": file " + filename + " exists and has valid format,"
       + " but contains fewer than 2 records. At least two interpolation points are required."
         );
   final UnivariateFunction function =
      interpolator.interpolate(ArrayUtil.toPrimitive(x), ArrayUtil.toPrimitive(y));
   this.interpolation = function;
   this.bounds = new SimpleDomainBounds(x.get(0), x.get(x.size()-1));
   this.outOfRangeEvaluation = new SimpleDomainBounds(y.get(0), y.get(y.size() - 1));
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:82,代码来源:FromFileTimeseriesParameter.java

示例8: addBindings

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
@Override
protected void addBindings() {
   bind(UnivariateInterpolator.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(SplineInterpolator.class);
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:7,代码来源:SplineUnivariateInterpolatorConfiguration.java

示例9: addBindings

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
@Override
protected void addBindings() {
   bind(UnivariateInterpolator.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(FloorInterpolator.class);
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:7,代码来源:FloorUnivariateInterpolatorConfiguration.java

示例10: setRequiredBindings

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
@Override
protected final void setRequiredBindings() {
   requireBinding(Key.get(UnivariateInterpolator.class, Names.named(getScopeString())));
   expose(Key.get(UnivariateInterpolator.class, Names.named(getScopeString())));
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:6,代码来源:AbstractUnivariateInterpolatorConfiguration.java

示例11: PolynomialInterpolator

import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator; //导入依赖的package包/类
/**
 * Constructs a polynomial interpolator to wrap the given univariate interpolator.
 * 
 * @param univariantInterpolator univariant interpolator to wrap
 */
public PolynomialInterpolator( UnivariateInterpolator univariantInterpolator ) {
    _univariateInterpolator = univariantInterpolator;
}
 
开发者ID:allyhume,项目名称:SBMLDataTools,代码行数:9,代码来源:PolynomialInterpolator.java


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