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


Java LinearInterpolator类代码示例

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


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

示例1: smooth

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
@Override
public double[] smooth(double[] sourceX, double[] noisyY, double[] estimateX, double parameter) {

	if(sourceX.length < 2)
	{
		return new double[sourceX.length];
	}
	
	LinearInterpolator interpolator = new LinearInterpolator();		
	PolynomialSplineFunction estimateFunc = interpolator.interpolate(sourceX, noisyY);
	double[] result = new double[estimateX.length];
	for(int i =0; i < estimateX.length;i++)
	{
		if(estimateFunc.isValidPoint(estimateX[i]))
		{
			result[i] = estimateFunc.value(estimateX[i]);
		}
		else
		{
			result[i] = Double.NaN;
		}
	}
	return result ;
}
 
开发者ID:cas-bioinf,项目名称:cy-dataseries,代码行数:25,代码来源:LinearSmoothingProvider.java

示例2: getMarketValueSplineFromTo

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
/**
 * Gets the market value spline from to.
 *
 * @param company the company
 * @param from the from
 * @param to the to
 * @return the market value spline from to
 */
public PolynomialSplineFunction getMarketValueSplineFromTo(Company company, Calendar from, Calendar to) {
	
	List<MarketValue> values = company.getMarketValuesBetweenDatesFromDB(from.getTime(), to.getTime());
	
	if(values.size() == 0 || !normalizeMarketValues(company, values, from, to)) {
		return null;
	}
					
	double[] x = new double[values.size()];
	double[] y = new double[values.size()];
	Calendar cal = Calendar.getInstance();
	for(int i = 0; i < values.size(); i++) {
		//System.out.println(values.get(i).getDate() + " " + values.get(i).getHigh());
		cal.setTime(values.get(i).getDate());
		x[i] = cal.getTimeInMillis();
		y[i] = values.get(i).getHigh();
	}
	
	return new LinearInterpolator().interpolate(x, y);
	
}
 
开发者ID:mattmagic149,项目名称:AnSoMia,代码行数:30,代码来源:MarketValueAnalyser.java

示例3: getMarketValueSplineFromTo

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
/**
 * Gets the market value spline from to.
 *
 * @param company the company
 * @param from the from
 * @param to the to
 * @return the market value spline from to
 */
public static PolynomialSplineFunction getMarketValueSplineFromTo(Company company,
																  Calendar from,
																  Calendar to) {
	
	List<MarketValue> values = company.getMarketValuesBetweenDatesFromDB(from.getTime(), to.getTime());
	
	if(values.size() == 0 || !normalizeMarketValues(company, values, from, to)) {
		return null;
	}
	
	//System.out.println("NOT NULL");
			
	double[] x = new double[values.size()];
	double[] y = new double[values.size()];
	Calendar cal = Calendar.getInstance();
	for(int i = 0; i < values.size(); i++) {
		cal.setTime(values.get(i).getDate());
		x[i] = cal.getTimeInMillis();
		y[i] = values.get(i).getHigh();
	}
	
	return new LinearInterpolator().interpolate(x, y);
	
}
 
开发者ID:mattmagic149,项目名称:AnSoMia,代码行数:33,代码来源:TestClass.java

示例4: createInterpolator

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的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

示例5: linearInterpFunc

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
/**
 * Make linear interpolation function - PolynomialSplineFunction
 * @param x X data
 * @param y Y data
 * @return Linear interpolation function
 */
public static PolynomialSplineFunction linearInterpFunc(Array x, Array y) {
    double[] xd = (double[]) ArrayUtil.copyToNDJavaArray(x);
    double[] yd = (double[]) ArrayUtil.copyToNDJavaArray(y);
    LinearInterpolator li = new LinearInterpolator(); 
    PolynomialSplineFunction psf = li.interpolate(xd, yd);

    return psf;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:15,代码来源:InterpUtil.java

示例6: UpdateDialogListener

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
UpdateDialogListener(double[] cx, double[] cy, double maxY, int centre, double scale, PlotWindow pw,
		Label label)
{
	offset = (int) cx[0];
	this.cy = cy;

	// Interpolate missing values
	int upper = cx.length - 1;
	if (cx[upper] - cx[0] != upper)
	{
		LinearInterpolator in = new LinearInterpolator();
		PolynomialSplineFunction f = in.interpolate(cx, cy);
		cx = SimpleArrayUtils.newArray(upper + 1, cx[0], 1.0);
		cy = new double[cx.length];
		for (int i = 0; i < cx.length; i++)
			cy[i] = f.value(cx[i]);
	}

	this.maxY = maxY;
	this.centre = centre;
	this.scale = scale;
	this.pw = pw;
	this.label = label;
	drawing = Utils.isShowGenericDialog();
	if (drawing)
		update();
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:28,代码来源:PSFDrift.java

示例7: interpolate

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
private void interpolate(double[] dx, double[] dy, double[] originalDriftTimePoints)
{
	// Interpolator can only create missing values within the range provided by the input values.
	// The two ends have to be extrapolated.
	// TODO: Perform extrapolation. Currently the end values are used.

	// Find end points
	int startT = 0;
	while (originalDriftTimePoints[startT] == 0)
		startT++;
	int endT = originalDriftTimePoints.length - 1;
	while (originalDriftTimePoints[endT] == 0)
		endT--;

	// Extrapolate using a constant value
	for (int t = startT; t-- > 0;)
	{
		dx[t] = dx[startT];
		dy[t] = dy[startT];
	}
	for (int t = endT; ++t < dx.length;)
	{
		dx[t] = dx[endT];
		dy[t] = dy[endT];
	}

	double[][] values = extractValues(originalDriftTimePoints, startT, endT, dx, dy);

	PolynomialSplineFunction fx, fy;
	if (values[0].length < 3)
	{
		fx = new LinearInterpolator().interpolate(values[0], values[1]);
		fy = new LinearInterpolator().interpolate(values[0], values[2]);
	}
	else
	{
		fx = new SplineInterpolator().interpolate(values[0], values[1]);
		fy = new SplineInterpolator().interpolate(values[0], values[2]);
	}

	for (int t = startT; t <= endT; t++)
	{
		if (originalDriftTimePoints[t] == 0)
		{
			dx[t] = fx.value(t);
			dy[t] = fy.value(t);
		}
	}

	this.interpolationStart = startT;
	this.interpolationEnd = endT;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:53,代码来源:DriftCalculator.java

示例8: readObject

import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入依赖的package包/类
/**
 * Read Object to deserialize.
 *
 * @param anInstream Stream Object data
 * @throws IOException thrown for IO Errors
 * @throws ClassNotFoundException thrown for class not being found
 */
private void readObject(ObjectInputStream anInstream)
        throws ClassNotFoundException, IOException {
    anInstream.defaultReadObject();
    previous=next=this;
    linear = new LinearInterpolator();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:14,代码来源:PSquarePercentile.java


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