public class HermiteInterpolator extends Object implements UnivariateDifferentiableVectorFunction, Serializable
WARNING: this class is not expected to remain in Orekit. It is provided by version 3.1 of Apache Commons Math. However, since as of writing (June 2012) this version is not released yet, Orekit depends on the latest official version 3.0 which does not provides this class. So despite it is implemented as a public class in Orekit so it can be used in from any package, it does not belong to Orekit public API and should not be used at application level. Once version 3.1 of Apache Commons Math is released, this class will be removed from Orekit.
The interpolation polynomials match all sample points, including both values and provided derivatives. There is one polynomial for each component of the values vector. All polynomial have the same degree. The degree of the polynomials depends on the number of points and number of derivatives at each point. For example the interpolation polynomials for n sample points without any derivatives all have degree n-1. The interpolation polynomials for n sample points with the two extreme points having value and first derivative and the remaining points having value only all have degree n+1. The interpolation polynomial for n sample points with value, first and second derivative for all points all have degree 3n-1.
Constructor and Description |
---|
HermiteInterpolator()
Create an empty interpolator.
|
Modifier and Type | Method and Description |
---|---|
void |
addSamplePoint(double x,
double[]... value)
Add a sample point.
|
double[] |
derivative(double x)
Interpolate first derivative at a specified abscissa.
|
PolynomialFunction[] |
getPolynomials()
Compute the interpolation polynomials.
|
int |
getSize()
Compute the size of the list of values of the function as created by the
UnivariateVectorFunction.value(double) method |
DerivativeStructure[] |
value(DerivativeStructure x)
Interpolate value at a specified abscissa.
|
double[] |
value(double x)
Interpolate value at a specified abscissa.
|
double[][] |
valueAndDerivative(double x,
boolean computeDoubleDerivative)
Interpolate value, first and optionally second derivative at a specified abscissa.
|
public void addSamplePoint(double x, double[]... value)
This method must be called once for each sample point. It is allowed to mix some calls with values only with calls with values and first derivatives.
The point abscissae for all calls must be different.
x
- abscissa of the sample pointvalue
- value and derivatives of the sample point
(if only one row is passed, it is the value, if two rows are
passed the first one is the value and the second the derivative
and so on)IllegalArgumentException
- if the abscissa is equals to a previously
added sample pointpublic PolynomialFunction[] getPolynomials()
IllegalStateException
- if sample is emptypublic double[] value(double x)
Calling this method is equivalent to call the value
methods of all polynomials returned by getPolynomials
, except it does not build
the intermediate polynomials, so this method is faster and numerically more stable.
value
in interface UnivariateVectorFunction
x
- interpolation abscissaIllegalStateException
- if sample is emptypublic double[] derivative(double x)
Calling this method is equivalent to call the value
methods of the derivatives of all polynomials returned by getPolynomials
, except
it builds neither the intermediate polynomials nor their derivatives, so this method is faster and numerically
more stable.
x
- interpolation abscissaIllegalStateException
- if sample is emptypublic double[][] valueAndDerivative(double x, boolean computeDoubleDerivative)
Calling this method is equivalent to call the value(DerivativeStructure)
method with a structure
representing 2 derivatives but is faster since it does not use the generic operations of the
DerivativeStructure
that are slower.
Calling this method is equivalent to call the value
method of the
derivatives of all polynomials returned by getPolynomials
, except it builds neither the
intermediate polynomials nor their derivatives, so this method is faster and numerically more stable.
x
- interpolation abscissacomputeDoubleDerivative
- Indicates whether the second derivative should be computedIllegalStateException
- if sample is emptypublic DerivativeStructure[] value(DerivativeStructure x)
Calling this method is equivalent to call the value
methods
of all polynomials returned by getPolynomials
, except it does not build the
intermediate polynomials, so this method is faster and numerically more stable.
value
in interface UnivariateDifferentiableVectorFunction
x
- interpolation abscissaNoDataException
- if sample is emptypublic int getSize()
UnivariateVectorFunction.value(double)
methodgetSize
in interface UnivariateVectorFunction
Copyright © 2023 CNES. All rights reserved.