Package noaa.coastwatch.util
Class UnivariateEstimator
java.lang.Object
noaa.coastwatch.util.Function
noaa.coastwatch.util.UnivariateEstimator
- All Implemented Interfaces:
Encodable
A univariate estimator approximates the value of a function of one
variable using a set of known function values. If the function
values are given by
[x1, x2,
... xn] then an estimator is set up based on the
function values using a polynomial of user-specified degree.
Suppose that the desired polynomial degree is 2 so that the
polynomial is a quadratic. Then a series of 3 coefficients
a0, a1, a2 are
calculated using the values, and the estimator will approximate
function values using the coefficients as f(x) =
a0 + a1x + a2x2.- Since:
- 3.1.0
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorsConstructorDescriptionUnivariateEstimator(double[] x, double[] f, int degree) Constructs a univariate estimator using the specified function values and polynomial degree.Constructs an estimator from the specified encoding. -
Method Summary
Modifier and TypeMethodDescriptiondoubleevaluate(double[] variables) Evalutes a function value with the specified inputs.Gets an encoded representation of this estimator.voiduseEncoding(Object obj) Uses an encoded representation of this estimator to recreate the estimator contents.
-
Constructor Details
-
UnivariateEstimator
public UnivariateEstimator(double[] x, double[] f, int degree) Constructs a univariate estimator using the specified function values and polynomial degree.- Parameters:
x- the array of x values.f- the function values atxpoints.degree- the desired polynomial degree.
-
UnivariateEstimator
Constructs an estimator from the specified encoding. The encoding must be a valid encoding of the estimator as created bygetEncoding.- Parameters:
obj- the object encoding.- See Also:
-
-
Method Details
-
evaluate
public double evaluate(double[] variables) Description copied from class:FunctionEvalutes a function value with the specified inputs. -
getEncoding
Gets an encoded representation of this estimator. The encoding may later be used to recreate the estimator without using the original function data.- Specified by:
getEncodingin interfaceEncodable- Overrides:
getEncodingin classFunction- Returns:
- the object encoding. The encoding object is a
double[]array of coefficients. - See Also:
-
useEncoding
Uses an encoded representation of this estimator to recreate the estimator contents.- Specified by:
useEncodingin interfaceEncodable- Overrides:
useEncodingin classFunction- Parameters:
obj- the object encoding.- See Also:
-