Class LaguerrePolynomialRootsEstimator


public class LaguerrePolynomialRootsEstimator extends PolynomialRootsEstimator
This class estimates the roots of a polynomial of degree n. p(x) = a0 * x^n + a1 * x^(n - 1) + ... a(n-1) * x + an then the array of parameters is [an, a(n-1), ... a1, a0] This class supports polynomials having either real or complex parameters.
  • Field Details

    • MR

      public static final int MR
      Constant that affects the number of iterations.
      See Also:
    • MT

      public static final int MT
      Constant that affects the number of iterations.
      See Also:
    • MAXIT

      public static final int MAXIT
      Maximum number of iterations.
      See Also:
    • LAGUER_EPS

      public static final double LAGUER_EPS
      Constant considered as machine precision for Laguerre method.
      See Also:
    • EPS

      public static final double EPS
      Constant considered as machine precision.
      See Also:
    • DEFAULT_POLISH_ROOTS

      public static final boolean DEFAULT_POLISH_ROOTS
      Constant indicating whether roots will be refined.
      See Also:
    • MIN_VALID_POLY_PARAMS_LENGTH

      public static final int MIN_VALID_POLY_PARAMS_LENGTH
      Minimum allowed length in polynomial parameters.
      See Also:
    • frac

      private static final double[] frac
      Array containing values for Laguerre method.
    • polishRoots

      private boolean polishRoots
      Indicates if roots should be refined.
  • Constructor Details

    • LaguerrePolynomialRootsEstimator

      public LaguerrePolynomialRootsEstimator(boolean polishRoots)
      Constructor.
      Parameters:
      polishRoots - Boolean to determine whether roots should be refined.
    • LaguerrePolynomialRootsEstimator

      public LaguerrePolynomialRootsEstimator()
      Empty constructor.
    • LaguerrePolynomialRootsEstimator

      public LaguerrePolynomialRootsEstimator(com.irurueta.algebra.Complex[] polyParams, boolean polishRoots)
      Constructor.
      Parameters:
      polyParams - Array containing polynomial parameters.
      polishRoots - Boolean indicating whether roots will be refined.
      Throws:
      IllegalArgumentException - Raised if length of provided parameters is not valid. It has to be greater or equal than 2.
    • LaguerrePolynomialRootsEstimator

      public LaguerrePolynomialRootsEstimator(com.irurueta.algebra.Complex[] polyParams)
      Constructor.
      Parameters:
      polyParams - Array containing polynomial parameters.
      Throws:
      IllegalArgumentException - Raised if length of provided parameters is not valid. It has to be greater or equal than 2.
  • Method Details

    • estimate

      Estimates the roots of provided polynomial.
      Overrides:
      estimate in class RootEstimator
      Throws:
      LockedException - Raised if this instance is locked estimating a root.
      NotReadyException - Raised if this instance is not ready because polynomial parameters have not been provided.
      RootEstimationException - Raised if roots cannot be estimated for some reason (lack of convergence, etc.).
    • areRootsPolished

      public boolean areRootsPolished()
      Returns boolean indicating whether roots are refined after an initial estimation.
      Returns:
      True if roots are refined, false otherwise.
    • setPolishRootsEnabled

      public void setPolishRootsEnabled(boolean enable) throws LockedException
      Sets boolean indicating whether roots will be refined after an initial estimation.
      Parameters:
      enable - True if roots will be refined, false otherwise.
      Throws:
      LockedException - Raised if this instance is locked.
    • internalSetPolynomialParameters

      protected final 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 [an, a(n - 1), ... a1, a0] Polynomial parameters can be either real or complex values This method does not check if this class is locked.
      Specified by:
      internalSetPolynomialParameters in class PolynomialRootsEstimator
      Parameters:
      polyParams - Polynomial parameters.
      Throws:
      IllegalArgumentException - Raised if the length of the array is not valid.
    • internalLaguer

      private void internalLaguer(com.irurueta.algebra.Complex[] a, com.irurueta.algebra.Complex x, int[] its) throws RootEstimationException
      Internal method to compute a root after decomposing and decreasing the degree of the polynomial.
      Parameters:
      a - Remaining polynomial parameters (on 1st iteration, the whole polynomial is provided, on subsequent iterations, the polynomial is deflated and the degree is reduced).
      x - Estimated root.
      its - number of iterations needed to achieve the estimation.
      Throws:
      RootEstimationException - Raised if root couldn't be estimated because of lack of convergence.