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 multidimensional functions
22 * f(x1, x2, ...) = a * f0(x1, x2, ...) + b * f1(x1, x2, ...) + ...
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 (x1, x2, ...), this interface will
26 * return an array containing the evaluations of the basis functions at such
27 * point f0(x1, x2, ...), f1(x1, x2, ...), ..., fM(x1, x2, ...)
28 */
29 public interface LinearFitterMultiDimensionFunctionEvaluator {
30
31 /**
32 * Number of dimensions of points (i.e. length of arrays) evaluated by
33 * this function evaluator
34 *
35 * @return number of dimensions of points
36 */
37 int getNumberOfDimensions();
38
39 /**
40 * Creates array where basis function results will be stored
41 *
42 * @return array where basis function results will be stored
43 */
44 double[] createResultArray();
45
46 /**
47 * Evaluates a linear multi dimension function at provided point and
48 * returns the evaluations of the basis functions at such point
49 *
50 * @param point point where function will be evaluated
51 * @param result array where result of evaluation of basis functions is
52 * stored
53 * @throws EvaluationException raised if something failed during the evaluation
54 */
55 void evaluate(final double[] point, final double[] result) throws EvaluationException;
56 }