View Javadoc
1   /*
2    * Copyright (C) 2015 Alberto Irurueta Carro (alberto@irurueta.com)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.numerical.fitting;
17  
18  import com.irurueta.numerical.EvaluationException;
19  
20  /**
21   * Interface to evaluate linear single dimensional functions
22   * f(x) = a * f0(x) + b * f1(x) + ...
23   * Where the linear function is composed of a linear combination of a basis of
24   * functions f0, f1, ... fM
25   * For each evaluation at a given point x, this interface will return an array
26   * containing the evaluations of the basis functions at such point f0(x), f1(x),
27   * ..., fM(x)
28   */
29  public interface LinearFitterSingleDimensionFunctionEvaluator {
30  
31      /**
32       * Creates array where basis function results will be stored
33       *
34       * @return array where basis function results will be stored
35       */
36      double[] createResultArray();
37  
38      /**
39       * Evaluates a linear single dimension function at provided point and
40       * returns the evaluations of the basis functions at such point
41       *
42       * @param point  point where function will be evaluated
43       * @param result array where result of evaluation of basis functions is
44       *               stored
45       * @throws EvaluationException raised if something failed during the evaluation
46       */
47      void evaluate(final double point, final double[] result) throws EvaluationException;
48  }