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

Make "CurveFitter" a generic class

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1
    • Labels:
      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

              • Assignee:
                erans Gilles
                Reporter:
                erans Gilles
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: