Package com.irurueta.numerical.roots
Class PolynomialRootsEstimator
java.lang.Object
com.irurueta.numerical.roots.RootEstimator
com.irurueta.numerical.roots.PolynomialRootsEstimator
- Direct Known Subclasses:
FirstDegreePolynomialRootsEstimator
,LaguerrePolynomialRootsEstimator
,SecondDegreePolynomialRootsEstimator
,ThirdDegreePolynomialRootsEstimator
Abstract class to estimate the roots of a polynomial.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.irurueta.algebra.Complex[]
Array containing parameters of a polynomial, taking into account that a polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ...protected com.irurueta.algebra.Complex[]
Array containing estimated roots.Fields inherited from class com.irurueta.numerical.roots.RootEstimator
locked
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns boolean indicating whether polynomial parameters have been provided and are available for retrieval.boolean
Returns boolean indicating whether roots have been estimated and are available for retrieval.com.irurueta.algebra.Complex[]
Returns array containing polynomial parameters.com.irurueta.algebra.Complex[]
getRoots()
Returns array of estimated polynomial roots.protected abstract void
internalSetPolynomialParameters
(com.irurueta.algebra.Complex[] polyParams) Internal method to set parameters of a polynomial, taking into account that a polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ...boolean
isReady()
Returns boolean indicating whether this instance is ready to start the estimation of the polynomial roots.void
setPolynomialParameters
(com.irurueta.algebra.Complex[] polyParams) Sets parameters of a polynomial, taking into account that a polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ...Methods inherited from class com.irurueta.numerical.roots.RootEstimator
estimate, isLocked
-
Field Details
-
polyParams
protected com.irurueta.algebra.Complex[] polyParamsArray containing parameters of a polynomial, taking into account that a polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ... a(n-1) * x + an then the array of parameters is [a0, a1, ... a(n - 1), an] -
roots
protected com.irurueta.algebra.Complex[] rootsArray containing estimated roots.
-
-
Constructor Details
-
PolynomialRootsEstimator
protected PolynomialRootsEstimator()Empty constructor.
-
-
Method Details
-
getPolynomialParameters
Returns array containing polynomial parameters.- Returns:
- Array of polynomial parameters.
- Throws:
NotAvailableException
- Raised if polynomial parameters have not been provided and are not available for retrieval.
-
setPolynomialParameters
public void setPolynomialParameters(com.irurueta.algebra.Complex[] polyParams) throws LockedException Sets parameters of a polynomial, taking into account that a polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ... a(n-1) * x + an then the array of parameters is [a0, a1, ... a(n - 1), an]- Parameters:
polyParams
- Polynomial parameters.- Throws:
LockedException
- Raised if this instance is locked.IllegalArgumentException
- Raised if the length of the array is not valid depending on the subclass implementation.
-
arePolynomialParametersAvailable
public boolean arePolynomialParametersAvailable()Returns boolean indicating whether polynomial parameters have been provided and are available for retrieval.- Returns:
- True if available, false otherwise.
-
isReady
public boolean isReady()Returns boolean indicating whether this instance is ready to start the estimation of the polynomial roots. This instance is considered to be ready once polynomial parameters are provided.- Overrides:
isReady
in classRootEstimator
- Returns:
- True if ready, false otherwise.
-
getRoots
Returns array of estimated polynomial roots. The array will have a length equal to the polynomial degree. If a polynomial has multiple roots, then such roots will be repeated.- Returns:
- Array of estimated polynomial roots
- Throws:
NotAvailableException
- Raised if roots have not yet been estimated and are not available for retrieval
-
areRootsAvailable
public boolean areRootsAvailable()Returns boolean indicating whether roots have been estimated and are available for retrieval.- Returns:
- True if available, false otherwise.
-
internalSetPolynomialParameters
protected abstract void internalSetPolynomialParameters(com.irurueta.algebra.Complex[] polyParams) Internal method to set parameters of a polynomial, taking into account that a polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ... a(n-1) * x + an then the array of parameters is [a0, a1, ... a(n - 1), an] This method does not check if this class is locked.- Parameters:
polyParams
- Polynomial parameters.- Throws:
IllegalArgumentException
- Raised if the length of the array is not valid depending on the subclass implementation.
-