Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-804

Make "CurveFitter" a generic class

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 3.1
    • None
    • None

    Description

      In order to enhance compile-time robustness, it is proposed to parameterize the "CurveFitter" class with the type of the function to be used for the fit, i.e.:

      public class CurveFitter<T extends ParametricUnivariateFunction> {
          // ...
      
          public double[] fit(T f, final double[] initialGuess) {
              // ...
          }
      
      }
      

      Thus enforcing that instances of subclasses like "PolynomialFitter" defined as

      public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric> {
          // ...
      }
      

      cannot call the "fit" method with a different function argument.

      Attachments

        Issue Links

          Activity

            People

              erans Gilles Sadowski
              erans Gilles Sadowski
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: