vec_math
Class CubicSpline

java.lang.Object
  extended by vec_math.CubicSpline
All Implemented Interfaces:
Function

public class CubicSpline
extends Object
implements Function

Cubic spline interpolation. Based on Num. Rec.


Field Summary
private  Vector2D[] sampling
          The sampling grid.
private  double[] spline
          The calculated y-two-primes.
 
Constructor Summary
  CubicSpline(String doubletokenize)
          Constructs a natural cubic spline from a string input by splitting the input on the semicolon and then constructing VectorGs out of it.
  CubicSpline(Vector2D[] grid)
          Constructs a natural cubic spline.
  CubicSpline(Vector2D[] grid, double yp0, double ypn)
          Constructs a cubic spline with both boundary values given.
  CubicSpline(Vector2D[] grid, Double yp0, Double ypn)
          Constructs a cubic spline with the two boundary values of the first derivative specified or natural, if null
private CubicSpline(Vector2D[] grid, Vector1D y2p0, Vector1D y2pn)
          Does a cubic spline interpolation, providing the first and second derivative on the end of the intervals.
 
Method Summary
private static Vector2D[] convert(VectorG[] two)
          Converts an array of VectorGs into an array of Vector2D or throws an exception, if a single non-two dimensional vector was found.
 double evaluate(double x)
          We evaluate the spline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sampling

private Vector2D[] sampling
The sampling grid.


spline

private double[] spline
The calculated y-two-primes.

Constructor Detail

CubicSpline

public CubicSpline(String doubletokenize)
Constructs a natural cubic spline from a string input by splitting the input on the semicolon and then constructing VectorGs out of it. Fails if the grid is not two-dimensional.


CubicSpline

public CubicSpline(Vector2D[] grid)
Constructs a natural cubic spline.


CubicSpline

public CubicSpline(Vector2D[] grid,
                   double yp0,
                   double ypn)
Constructs a cubic spline with both boundary values given.


CubicSpline

public CubicSpline(Vector2D[] grid,
                   Double yp0,
                   Double ypn)
Constructs a cubic spline with the two boundary values of the first derivative specified or natural, if null


CubicSpline

private CubicSpline(Vector2D[] grid,
                    Vector1D y2p0,
                    Vector1D y2pn)
Does a cubic spline interpolation, providing the first and second derivative on the end of the intervals. Note that the vectors are constructed depending on the constructor used.

Method Detail

convert

private static Vector2D[] convert(VectorG[] two)
Converts an array of VectorGs into an array of Vector2D or throws an exception, if a single non-two dimensional vector was found.


evaluate

public double evaluate(double x)
We evaluate the spline.

Specified by:
evaluate in interface Function