Class PolynomialEstimator

java.lang.Object
com.irurueta.numerical.polynomials.estimators.PolynomialEstimator
Direct Known Subclasses:
LMSEPolynomialEstimator, WeightedPolynomialEstimator

public abstract class PolynomialEstimator extends Object
This class defines the interface for an estimator of a polynomial of a given degree using points where polynomials are evaluated.
  • Field Details

    • MIN_DEGREE

      public static final int MIN_DEGREE
      Minimum allowed degree to be estimated
      See Also:
    • DEFAULT_ESTIMATOR_TYPE

      public static final PolynomialEstimatorType DEFAULT_ESTIMATOR_TYPE
      Default estimator type.
    • degree

      protected int degree
      Degree of polynomial to be estimated.
    • evaluations

      protected List<PolynomialEvaluation> evaluations
      Collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree.
    • locked

      protected boolean locked
      True when estimator is estimating radial distortion.
    • listener

      protected PolynomialEstimatorListener listener
      Listener to be notified of events such as when estimation starts, ends or estimation progress changes.
  • Constructor Details

    • PolynomialEstimator

      protected PolynomialEstimator()
      Constructor.
    • PolynomialEstimator

      protected PolynomialEstimator(int degree)
      Constructor.
      Parameters:
      degree - degree of polynomial to be estimated.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • PolynomialEstimator

      protected PolynomialEstimator(List<PolynomialEvaluation> evaluations)
      Constructor.
      Parameters:
      evaluations - collection of polynomial evaluations.
    • PolynomialEstimator

      protected PolynomialEstimator(PolynomialEstimatorListener listener)
      Constructor.
      Parameters:
      listener - listener to be notified of events.
    • PolynomialEstimator

      protected PolynomialEstimator(int degree, List<PolynomialEvaluation> evaluations)
      Constructor.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • PolynomialEstimator

      protected PolynomialEstimator(int degree, PolynomialEstimatorListener listener)
      Constructor.
      Parameters:
      degree - degree of polynomial to be estimated.
      listener - listener to be notified of events.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • PolynomialEstimator

      protected PolynomialEstimator(List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener)
      Constructor.
      Parameters:
      evaluations - collection of polynomial evaluations.
      listener - listener to be notified of events.
    • PolynomialEstimator

      protected PolynomialEstimator(int degree, List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener)
      Constructor.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      listener - listener to be notified of events.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
  • Method Details

    • getDegree

      public int getDegree()
      Gets degree of polynomial to be estimated.
      Returns:
      degree of polynomial to be estimated.
    • setDegree

      public void setDegree(int degree) throws LockedException
      Sets degree of polynomial to be estimated.
      Parameters:
      degree - degree of polynomial to be estimated.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
      LockedException - if this instance is locked.
    • getEvaluations

      public List<PolynomialEvaluation> getEvaluations()
      Gets collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree.
      Returns:
      collection of polynomial evaluations.
    • setEvaluations

      public void setEvaluations(List<PolynomialEvaluation> evaluations) throws LockedException
      Sets collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree.
      Parameters:
      evaluations - collection of polynomial evaluations.
      Throws:
      LockedException - if this instance is locked.
    • setDegreeAndEvaluations

      public void setDegreeAndEvaluations(int degree, List<PolynomialEvaluation> evaluations) throws LockedException
      Sets degree of polynomial to be estimated and collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of specified degree.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
      LockedException - if this instance is locked.
    • isReady

      public boolean isReady()
      Determines whether estimation is ready to start with the given data and required degree of polynomial to be estimated
      Returns:
      true if estimator is ready, false otherwise.
    • getMinNumberOfEvaluations

      public static int getMinNumberOfEvaluations(int degree)
      Gets minimum number of evaluations required to estimate a polynomial of the specified degree.
      Parameters:
      degree - degree of polynomial to be estimated.
      Returns:
      number of required evaluations.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • getMinNumberOfEvaluations

      public int getMinNumberOfEvaluations()
      Gets minimum number of evaluations required to estimate a polynomial of the specified degree.
      Returns:
      number of required evaluations.
    • isLocked

      public boolean isLocked()
      Indicates whether this instance is locked.
      Returns:
      true if this estimator is busy estimating a polynomial, false otherwise.
    • getListener

      public PolynomialEstimatorListener getListener()
      Gets listener to be notified of events such as when estimation starts, ends or estimation progress changes.
      Returns:
      listener to be notified of events.
    • setListener

      public void setListener(PolynomialEstimatorListener listener) throws LockedException
      Sets listener to be notified of events such as when estimation starts, ends or estimation progress changes.
      Parameters:
      listener - listener to be notified of events.
      Throws:
      LockedException - if estimator is locked.
    • estimate

      Estimates a polynomial based on provided evaluations.
      Returns:
      estimated polynomial.
      Throws:
      LockedException - if estimator is locked.
      NotReadyException - if estimator is not ready.
      PolynomialEstimationException - if polynomial estimation fails.
    • getType

      public abstract PolynomialEstimatorType getType()
      Returns type of polynomial estimator.
      Returns:
      type of polynomial estimator.
    • create

      public static PolynomialEstimator create()
      Creates an instance of a polynomial estimator using default type.
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(int degree)
      Creates an instance of a polynomial estimator using provided degree and default type.
      Parameters:
      degree - degree of polynomial to be estimated.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      public static PolynomialEstimator create(List<PolynomialEvaluation> evaluations)
      Creates an instance of a polynomial estimator using provided evaluations, and default type and degree.
      Parameters:
      evaluations - collection of polynomial evaluations.
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(PolynomialEstimatorListener listener)
      Creates an instance of a polynomial estimator using provided listener and default type and degree.
      Parameters:
      listener - listener to be notified of events.
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(int degree, List<PolynomialEvaluation> evaluations)
      Creates an instance of a polynomial estimator using provided degree, polynomial evaluations and default type.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      public static PolynomialEstimator create(int degree, PolynomialEstimatorListener listener)
      Creates an instance of a polynomial estimator using provided degree, listener and default type.
      Parameters:
      degree - degree of polynomial to be estimated.
      listener - listener to be notified of events.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      public static PolynomialEstimator create(List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener)
      Creates an instance of a polynomial estimator using provided evaluations, listener and default type.
      Parameters:
      evaluations - collection of polynomial evaluations.
      listener - listener to be notified of events.
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(int degree, List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener)
      Creates an instance of a polynomial estimator using provided degree, evaluations, listener and default type.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      listener - listener to be notified of events.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      public static PolynomialEstimator create(PolynomialEstimatorType type)
      Creates an instance of a polynomial estimator using provided type and default degree.
      Parameters:
      type - type of polynomial estimator
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(int degree, PolynomialEstimatorType type)
      Creates an instance of a polynomial estimator using provided degree and type.
      Parameters:
      degree - degree of polynomial to be estimated.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      public static PolynomialEstimator create(List<PolynomialEvaluation> evaluations, PolynomialEstimatorType type)
      Creates an instance of a polynomial estimator using provided evaluations and type.
      Parameters:
      evaluations - collection of polynomial evaluations.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
    • create

      Creates an instance of a polynomial estimator using provided listener and type.
      Parameters:
      listener - listener to be notified of events.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(int degree, List<PolynomialEvaluation> evaluations, PolynomialEstimatorType type)
      Creates an instance of a polynomial estimator using provided degree, evaluations and type.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      public static PolynomialEstimator create(int degree, PolynomialEstimatorListener listener, PolynomialEstimatorType type)
      Creates an instance of a polynomial estimator using provided degree, listener and type.
      Parameters:
      degree - degree of polynomial to be estimated.
      listener - listener to be notified of events.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • create

      Creates an instance of a polynomial estimator using provided evaluations, listener and type.
      Parameters:
      evaluations - collection of polynomial evaluations.
      listener - listener to be notified of events.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
    • create

      public static PolynomialEstimator create(int degree, List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener, PolynomialEstimatorType type)
      Creates an instance of a polynomial estimator using provided degree, evaluations, listener and type.
      Parameters:
      degree - degree of polynomial to be estimated.
      evaluations - collection of polynomial evaluations.
      listener - listener to be notified of events.
      type - type of polynomial estimator.
      Returns:
      an instance of a polynomial estimator.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.
    • fillDirectEvaluation

      protected void fillDirectEvaluation(DirectPolynomialEvaluation evaluation, com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row)
      Fills row of system of equations for a direct polynomial evaluation.
      Parameters:
      evaluation - a direct polynomial evaluation.
      a - system matrix.
      b - values matrix.
      row - row to be filled.
    • fillDerivativeEvaluation

      protected void fillDerivativeEvaluation(DerivativePolynomialEvaluation evaluation, com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row)
      Fills row of system of equations for a derivative polynomial evaluation.
      Parameters:
      evaluation - a derivative polynomial evaluation.
      a - system matrix.
      b - values matrix.
      row - row to be filled.
    • fillIntegralEvaluation

      protected void fillIntegralEvaluation(IntegralPolynomialEvaluation evaluation, com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row) throws PolynomialEstimationException
      Fills row of system of equations for an integral polynomial evaluation.
      Parameters:
      evaluation - an integral polynomial evaluation.
      a - system matrix.
      b - values matrix.
      row - row to be filled.
      Throws:
      PolynomialEstimationException - if constant terms does not have proper size (it must be null or have order length).
    • fillIntegralIntervalEvaluation

      protected void fillIntegralIntervalEvaluation(IntegralIntervalPolynomialEvaluation evaluation, com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row) throws PolynomialEstimationException
      Fills row of system of equations for a polynomial evaluation of an interval integration.
      Parameters:
      evaluation - an interval integration of a polynomial evaluation.
      a - system matrix.
      b - values matrix.
      row - row to be filled.
      Throws:
      PolynomialEstimationException - if constant terms does not have proper size (it must be null or have order length).
    • normalize

      protected void normalize(com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row)
      Normalizes rows of system matrix and values matrix to increase accuracy of linear system of equations to be solved.
      Parameters:
      a - system matrix.
      b - values matrix.
      row - row to normalize.
    • internalSetDegree

      private void internalSetDegree(int degree)
      Internal method to set degree of polynomial to be estimated.
      Parameters:
      degree - degree of polynomial to be estimated.
      Throws:
      IllegalArgumentException - if provided degree is less than 1.