org.apache.commons.math3.analysis.interpolation

## Class UnivariatePeriodicInterpolator

- java.lang.Object
- - org.apache.commons.math3.analysis.interpolation.UnivariatePeriodicInterpolator

All Implemented Interfaces:
  UnivariateInterpolator

    public class UnivariatePeriodicInterpolator
    extends java.lang.Object
    implements UnivariateInterpolator

Adapter for classes implementing the `UnivariateInterpolator` interface. The data to be interpolated is assumed to be periodic. Thus values that are outside of the range can be passed to the interpolation function: They will be wrapped into the initial range before being passed to the class that actually computes the interpolation.

Version:
  $Id: UnivariatePeriodicInterpolator.java 1379904 2012-09-01 23:54:52Z erans $

### Field Summary

Fields
`static int` `DEFAULT_EXTEND` Default number of extension points of the samples array.
`private int` `extend` Number of extension points.
`private UnivariateInterpolator` `interpolator` Interpolator.
`private double` `period` Period.

### Constructor Summary

Constructors
Constructor and Description
`UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator, double period)` Builds an interpolator.
`UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator, double period, int extend)` Builds an interpolator.

### Method Summary

Methods
`UnivariateFunction` `interpolate(double[] xval, double[] yval)` Compute an interpolating function for the dataset.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_EXTEND

    public static final int DEFAULT_EXTEND

Default number of extension points of the samples array.

See Also:
  Constant Field Values

#### interpolator

    private final UnivariateInterpolator interpolator

Interpolator.

#### period

    private final double period

Period.

#### extend

    private final int extend

Number of extension points.

### Constructor Detail

#### UnivariatePeriodicInterpolator

    public UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator,
                                  double period,
                                  int extend)

Builds an interpolator.

Parameters:
  `interpolator` - Interpolator.
  `period` - Period.
  `extend` - Number of points to be appended at the beginning and end of the sample arrays in order to avoid interpolation failure at the (periodic) boundaries of the orginal interval. The value is the number of sample points which the original `interpolator` needs on each side of the interpolated point.

#### UnivariatePeriodicInterpolator

    public UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator,
                                  double period)

Builds an interpolator. Uses `DEFAULT_EXTEND` as the number of extension points on each side of the original abscissae range.

Parameters:
  `interpolator` - Interpolator.
  `period` - Period.

### Method Detail

#### interpolate

    public UnivariateFunction interpolate(double[] xval,
                                 double[] yval)
                                   throws NumberIsTooSmallException

Compute an interpolating function for the dataset.

Specified by:
  `interpolate` in interface `UnivariateInterpolator`
Parameters:
  `xval` - Arguments for the interpolation points.
  `yval` - Values for the interpolation points.
Returns:
  a function which interpolates the dataset.
Throws:
  `NumberIsTooSmallException` - if the number of extension points iss larger then the size of `xval`.