Class PolynomialEstimator
java.lang.Object
com.irurueta.numerical.polynomials.estimators.PolynomialEstimator
- Direct Known Subclasses:
LMSEPolynomialEstimator
,WeightedPolynomialEstimator
This class defines the interface for an estimator of a polynomial of a given
degree using points where polynomials are evaluated.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PolynomialEstimatorType
Default estimator type.protected int
Degree of polynomial to be estimated.protected List<PolynomialEvaluation>
Collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree.protected PolynomialEstimatorListener
Listener to be notified of events such as when estimation starts, ends or estimation progress changes.protected boolean
True when estimator is estimating radial distortion.static final int
Minimum allowed degree to be estimated -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor.protected
PolynomialEstimator
(int degree) Constructor.protected
PolynomialEstimator
(int degree, PolynomialEstimatorListener listener) Constructor.protected
PolynomialEstimator
(int degree, List<PolynomialEvaluation> evaluations) Constructor.protected
PolynomialEstimator
(int degree, List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener) Constructor.protected
Constructor.protected
PolynomialEstimator
(List<PolynomialEvaluation> evaluations) Constructor.protected
PolynomialEstimator
(List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic PolynomialEstimator
create()
Creates an instance of a polynomial estimator using default type.static PolynomialEstimator
create
(int degree) Creates an instance of a polynomial estimator using provided degree and default type.static PolynomialEstimator
create
(int degree, PolynomialEstimatorListener listener) Creates an instance of a polynomial estimator using provided degree, listener and default type.static PolynomialEstimator
create
(int degree, PolynomialEstimatorListener listener, PolynomialEstimatorType type) Creates an instance of a polynomial estimator using provided degree, listener and type.static PolynomialEstimator
create
(int degree, PolynomialEstimatorType type) Creates an instance of a polynomial estimator using provided degree and type.static PolynomialEstimator
create
(int degree, List<PolynomialEvaluation> evaluations) Creates an instance of a polynomial estimator using provided degree, polynomial evaluations and default type.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.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.static PolynomialEstimator
create
(int degree, List<PolynomialEvaluation> evaluations, PolynomialEstimatorType type) Creates an instance of a polynomial estimator using provided degree, evaluations and type.static PolynomialEstimator
create
(PolynomialEstimatorListener listener) Creates an instance of a polynomial estimator using provided listener and default type and degree.static PolynomialEstimator
create
(PolynomialEstimatorListener listener, PolynomialEstimatorType type) Creates an instance of a polynomial estimator using provided listener and type.static PolynomialEstimator
Creates an instance of a polynomial estimator using provided type and default degree.static PolynomialEstimator
create
(List<PolynomialEvaluation> evaluations) Creates an instance of a polynomial estimator using provided evaluations, and default type and degree.static PolynomialEstimator
create
(List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener) Creates an instance of a polynomial estimator using provided evaluations, listener and default type.static PolynomialEstimator
create
(List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener, PolynomialEstimatorType type) Creates an instance of a polynomial estimator using provided evaluations, listener and type.static PolynomialEstimator
create
(List<PolynomialEvaluation> evaluations, PolynomialEstimatorType type) Creates an instance of a polynomial estimator using provided evaluations and type.abstract Polynomial
estimate()
Estimates a polynomial based on provided evaluations.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.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.protected void
fillIntegralEvaluation
(IntegralPolynomialEvaluation evaluation, com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row) Fills row of system of equations for an integral polynomial evaluation.protected void
fillIntegralIntervalEvaluation
(IntegralIntervalPolynomialEvaluation evaluation, com.irurueta.algebra.Matrix a, com.irurueta.algebra.Matrix b, int row) Fills row of system of equations for a polynomial evaluation of an interval integration.int
Gets degree of polynomial to be estimated.Gets collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree.Gets listener to be notified of events such as when estimation starts, ends or estimation progress changes.int
Gets minimum number of evaluations required to estimate a polynomial of the specified degree.static int
getMinNumberOfEvaluations
(int degree) Gets minimum number of evaluations required to estimate a polynomial of the specified degree.abstract PolynomialEstimatorType
getType()
Returns type of polynomial estimator.private void
internalSetDegree
(int degree) Internal method to set degree of polynomial to be estimated.boolean
isLocked()
Indicates whether this instance is locked.boolean
isReady()
Determines whether estimation is ready to start with the given data and required degree of polynomial to be estimatedprotected 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.void
setDegree
(int degree) Sets degree of polynomial to be estimated.void
setDegreeAndEvaluations
(int degree, List<PolynomialEvaluation> evaluations) 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.void
setEvaluations
(List<PolynomialEvaluation> evaluations) Sets collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree.void
setListener
(PolynomialEstimatorListener listener) Sets listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
Field Details
-
MIN_DEGREE
public static final int MIN_DEGREEMinimum allowed degree to be estimated- See Also:
-
DEFAULT_ESTIMATOR_TYPE
Default estimator type. -
degree
protected int degreeDegree of polynomial to be estimated. -
evaluations
Collection of polynomial evaluations and their corresponding point of evaluation used to determine a polynomial of required degree. -
locked
protected boolean lockedTrue when estimator is estimating radial distortion. -
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
Constructor.- Parameters:
evaluations
- collection of polynomial evaluations.
-
PolynomialEstimator
Constructor.- Parameters:
listener
- listener to be notified of events.
-
PolynomialEstimator
Constructor.- Parameters:
degree
- degree of polynomial to be estimated.evaluations
- collection of polynomial evaluations.- Throws:
IllegalArgumentException
- if provided degree is less than 1.
-
PolynomialEstimator
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
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
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
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
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
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
public abstract Polynomial estimate() throws LockedException, NotReadyException, PolynomialEstimationExceptionEstimates 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
Returns type of polynomial estimator.- Returns:
- type of polynomial estimator.
-
create
Creates an instance of a polynomial estimator using default type.- Returns:
- an instance of a polynomial estimator.
-
create
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
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
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
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
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
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
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
public static PolynomialEstimator create(PolynomialEstimatorListener listener, PolynomialEstimatorType type) 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
public static PolynomialEstimator create(List<PolynomialEvaluation> evaluations, PolynomialEstimatorListener listener, PolynomialEstimatorType type) 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.
-