uk.ac.starlink.diva.interp
Class LinearInterp

java.lang.Object
  extended by uk.ac.starlink.diva.interp.AbstractInterpolator
      extended by uk.ac.starlink.diva.interp.LinearInterp
All Implemented Interfaces:
Interpolator
Direct Known Subclasses:
AkimaSplineInterp, CubicSplineInterp, HermiteSplineInterp, PolynomialInterp

public class LinearInterp
extends AbstractInterpolator

Interpolate values using a linear scheme.

Version:
$Id$
Author:
Peter W. Draper

Field Summary
 
Fields inherited from class uk.ac.starlink.diva.interp.AbstractInterpolator
c, decr, x, y
 
Constructor Summary
LinearInterp()
          Create an instance with no coordinates.
LinearInterp(double[] x, double[] y)
          Create an instance with the given coordinates.
 
Method Summary
 int guessStep()
           
 double interpolate(double xp)
          Return the interpolated value corresponding to some arbitrary X coordinate.
static void main(String[] args)
          Simple test entry point
 
Methods inherited from class uk.ac.starlink.diva.interp.AbstractInterpolator
appendValue, binarySearch, evalYData, evalYDataArray, getCount, getXCoord, getXCoords, getYCoord, getYCoords, isFull, isIncreasing, setCoords, stepGuess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearInterp

public LinearInterp()
Create an instance with no coordinates. A call to setValues must be made before any other methods.


LinearInterp

public LinearInterp(double[] x,
                    double[] y)
Create an instance with the given coordinates. Interpolation is by X coordinate see the interpolate method. The X coordinates should be monotonic, either increasing or decreasing. Same value X coordinates are not allowed.

Parameters:
x - the X coordinates.
y - the Y coordinates.
Method Detail

interpolate

public double interpolate(double xp)
Description copied from interface: Interpolator
Return the interpolated value corresponding to some arbitrary X coordinate.

Specified by:
interpolate in interface Interpolator
Specified by:
interpolate in class AbstractInterpolator
Parameters:
xp - the X coordinate at which an interpolated Y coordinate is required.
Returns:
the interpolated value.

guessStep

public int guessStep()

main

public static void main(String[] args)
Simple test entry point



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.