List of usage examples for org.apache.commons.math3.analysis.interpolation PiecewiseBicubicSplineInterpolator PiecewiseBicubicSplineInterpolator
PiecewiseBicubicSplineInterpolator
From source file:com.gordoni.opal.BiInterpolator.java
public BiInterpolator(MapPeriod mp, int what) { this.mp = mp; Scenario scenario = mp.scenario;/*from ww w . j a va 2 s .com*/ Config config = scenario.config; xval = new double[mp.length[0]]; for (int i = 0; i < xval.length; i++) xval[(xval.length - 1) - i] = scenario.scale[0].bucket_to_pf(mp.bottom[0] + i); yval = new double[mp.length[1]]; for (int i = 0; i < yval.length; i++) yval[(yval.length - 1) - i] = scenario.scale[1].bucket_to_pf(mp.bottom[1] + i); fval = new double[mp.length[0]][mp.length[1]]; MapPeriodIterator<MapElement> mpitr = mp.iterator(); while (mpitr.hasNext()) { int[] bucket = mpitr.nextIndex().clone(); MapElement me = mpitr.next(); int xindex = (xval.length - 1) - (bucket[0] - mp.bottom[0]); int yindex = (yval.length - 1) - (bucket[1] - mp.bottom[1]); fval[xindex][yindex] = getWhat(me, what); } BivariateGridInterpolator interpolator; if (config.interpolation2.equals("spline")) interpolator = new PiecewiseBicubicSplineInterpolator(); else { assert (false); return; } this.f = interpolator.interpolate(xval, yval, fval); }
From source file:org.apache.solr.client.solrj.io.eval.BicubicSplineEvaluator.java
@Override public Object doWork(Object... objects) throws IOException { if (objects.length != 3) { throw new IOException( "The bicubicSpline function requires three paremeters," + objects.length + " found."); }//ww w .jav a 2 s . c om Object first = objects[0]; Object second = objects[1]; Object third = objects[2]; double[] x = null; double[] y = null; double[][] grid = null; if (first instanceof List && second instanceof List && third instanceof Matrix) { List<Number> xlist = (List<Number>) first; x = new double[xlist.size()]; for (int i = 0; i < x.length; i++) { x[i] = xlist.get(i).doubleValue(); } List<Number> ylist = (List<Number>) second; y = new double[ylist.size()]; for (int i = 0; i < y.length; i++) { y[i] = ylist.get(i).doubleValue(); } Matrix matrix = (Matrix) third; grid = matrix.getData(); PiecewiseBicubicSplineInterpolator interpolator = new PiecewiseBicubicSplineInterpolator(); BivariateFunction bivariateFunction = interpolator.interpolate(x, y, grid); return bivariateFunction; } else { throw new IOException( "The bicubicSpline function expects two numeric arrays and a matrix as parameters."); } }
From source file:org.orekit.models.earth.FixedTroposphericDelay.java
/** Creates a new {@link FixedTroposphericDelay} instance. * @param xArr abscissa grid for the interpolation function * @param yArr ordinate grid for the interpolation function * @param fArr values samples for the interpolation function *///w w w .j a v a2 s .co m public FixedTroposphericDelay(final double[] xArr, final double[] yArr, final double[][] fArr) { this.xArr = xArr.clone(); this.yArr = yArr.clone(); this.fArr = fArr.clone(); delayFunction = new PiecewiseBicubicSplineInterpolator().interpolate(xArr, yArr, fArr); }
From source file:org.orekit.models.earth.FixedTroposphericDelay.java
/** Creates a new {@link FixedTroposphericDelay} instance, and loads the * delay values from the given resource via the {@link DataProvidersManager}. * @param supportedName a regular expression for supported resource names * @throws OrekitException if the resource could not be loaded *//*from ww w . j a v a 2 s . co m*/ public FixedTroposphericDelay(final String supportedName) throws OrekitException { final InterpolationTableLoader loader = new InterpolationTableLoader(); DataProvidersManager.getInstance().feed(supportedName, loader); if (!loader.stillAcceptsData()) { xArr = loader.getAbscissaGrid(); yArr = loader.getOrdinateGrid(); fArr = loader.getValuesSamples(); delayFunction = new PiecewiseBicubicSplineInterpolator().interpolate(xArr, yArr, fArr); } else { throw new OrekitException(OrekitMessages.UNABLE_TO_FIND_RESOURCE, supportedName); } }
From source file:uk.ac.diamond.scisoft.analysis.dataset.function.Interpolation2D.java
public static Dataset piecewiseBicubicSplineInterpolation(IDataset oldx, IDataset oldy, IDataset oldxy, IDataset newx, IDataset newy) {//from w w w . j a va 2 s . c om return interpolate(oldx, oldy, oldxy, newx, newy, new PiecewiseBicubicSplineInterpolator()); }