Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
NevilleInterpolator |
|
| 1.0;1 |
1 | /* |
|
2 | * Copyright 2003-2005 The Apache Software Foundation. |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package org.apache.commons.math.analysis; |
|
17 | ||
18 | import java.io.Serializable; |
|
19 | import org.apache.commons.math.MathException; |
|
20 | ||
21 | /** |
|
22 | * Implements the <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html"> |
|
23 | * Neville's Algorithm</a> for interpolation of real univariate functions. For |
|
24 | * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X, |
|
25 | * chapter 2. |
|
26 | * <p> |
|
27 | * The actual code of Neville's evalution is in PolynomialFunctionLagrangeForm, |
|
28 | * this class provides an easy-to-use interface to it. |
|
29 | * |
|
30 | * @version $Revision$ $Date$ |
|
31 | */ |
|
32 | 6 | public class NevilleInterpolator implements UnivariateRealInterpolator, |
33 | Serializable { |
|
34 | ||
35 | /** serializable version identifier */ |
|
36 | static final long serialVersionUID = 3003707660147873733L; |
|
37 | ||
38 | /** |
|
39 | * Computes an interpolating function for the data set. |
|
40 | * |
|
41 | * @param x the interpolating points array |
|
42 | * @param y the interpolating values array |
|
43 | * @return a function which interpolates the data set |
|
44 | * @throws MathException if arguments are invalid |
|
45 | */ |
|
46 | public UnivariateRealFunction interpolate(double x[], double y[]) throws |
|
47 | MathException { |
|
48 | ||
49 | PolynomialFunctionLagrangeForm p; |
|
50 | 6 | p = new PolynomialFunctionLagrangeForm(x, y); |
51 | 6 | return p; |
52 | } |
|
53 | } |