Class UnivariateEstimator

java.lang.Object
noaa.coastwatch.util.Function
noaa.coastwatch.util.UnivariateEstimator
All Implemented Interfaces:
Encodable

public class UnivariateEstimator extends Function
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 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 at x points.
      degree - the desired polynomial degree.
    • UnivariateEstimator

      public UnivariateEstimator(Object obj)
      Constructs an estimator from the specified encoding. The encoding must be a valid encoding of the estimator as created by getEncoding.
      Parameters:
      obj - the object encoding.
      See Also:
  • Method Details

    • evaluate

      public double evaluate(double[] variables)
      Description copied from class: Function
      Evalutes a function value with the specified inputs.
      Specified by:
      evaluate in class Function
      Parameters:
      variables - the array of input variable values.
      Returns:
      the evaluated function value. If an error occurred during evaluation, the return value is Double.NaN.
    • getEncoding

      public Object 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:
      getEncoding in interface Encodable
      Overrides:
      getEncoding in class Function
      Returns:
      the object encoding. The encoding object is a double[] array of coefficients.
      See Also:
    • useEncoding

      public void useEncoding(Object obj)
      Uses an encoded representation of this estimator to recreate the estimator contents.
      Specified by:
      useEncoding in interface Encodable
      Overrides:
      useEncoding in class Function
      Parameters:
      obj - the object encoding.
      See Also: