1 | /*
|
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | * contributor license agreements. See the NOTICE file distributed with
|
---|
4 | * this work for additional information regarding copyright ownership.
|
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | * (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | * See the License for the specific language governing permissions and
|
---|
15 | * limitations under the License.
|
---|
16 | */
|
---|
17 | package agents.anac.y2019.harddealer.math3.fitting.leastsquares;
|
---|
18 |
|
---|
19 | import agents.anac.y2019.harddealer.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
|
---|
20 | import agents.anac.y2019.harddealer.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
|
---|
21 | import agents.anac.y2019.harddealer.math3.linear.RealMatrix;
|
---|
22 | import agents.anac.y2019.harddealer.math3.linear.RealVector;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * A pedantic implementation of {@link Optimum}.
|
---|
26 | *
|
---|
27 | * @since 3.3
|
---|
28 | */
|
---|
29 | class OptimumImpl implements Optimum {
|
---|
30 |
|
---|
31 | /** abscissa and ordinate */
|
---|
32 | private final Evaluation value;
|
---|
33 | /** number of evaluations to compute this optimum */
|
---|
34 | private final int evaluations;
|
---|
35 | /** number of iterations to compute this optimum */
|
---|
36 | private final int iterations;
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Construct an optimum from an evaluation and the values of the counters.
|
---|
40 | *
|
---|
41 | * @param value the function value
|
---|
42 | * @param evaluations number of times the function was evaluated
|
---|
43 | * @param iterations number of iterations of the algorithm
|
---|
44 | */
|
---|
45 | OptimumImpl(final Evaluation value, final int evaluations, final int iterations) {
|
---|
46 | this.value = value;
|
---|
47 | this.evaluations = evaluations;
|
---|
48 | this.iterations = iterations;
|
---|
49 | }
|
---|
50 |
|
---|
51 | /* auto-generated implementations */
|
---|
52 |
|
---|
53 | /** {@inheritDoc} */
|
---|
54 | public int getEvaluations() {
|
---|
55 | return evaluations;
|
---|
56 | }
|
---|
57 |
|
---|
58 | /** {@inheritDoc} */
|
---|
59 | public int getIterations() {
|
---|
60 | return iterations;
|
---|
61 | }
|
---|
62 |
|
---|
63 | /** {@inheritDoc} */
|
---|
64 | public RealMatrix getCovariances(double threshold) {
|
---|
65 | return value.getCovariances(threshold);
|
---|
66 | }
|
---|
67 |
|
---|
68 | /** {@inheritDoc} */
|
---|
69 | public RealVector getSigma(double covarianceSingularityThreshold) {
|
---|
70 | return value.getSigma(covarianceSingularityThreshold);
|
---|
71 | }
|
---|
72 |
|
---|
73 | /** {@inheritDoc} */
|
---|
74 | public double getRMS() {
|
---|
75 | return value.getRMS();
|
---|
76 | }
|
---|
77 |
|
---|
78 | /** {@inheritDoc} */
|
---|
79 | public RealMatrix getJacobian() {
|
---|
80 | return value.getJacobian();
|
---|
81 | }
|
---|
82 |
|
---|
83 | /** {@inheritDoc} */
|
---|
84 | public double getCost() {
|
---|
85 | return value.getCost();
|
---|
86 | }
|
---|
87 |
|
---|
88 | /** {@inheritDoc} */
|
---|
89 | public RealVector getResiduals() {
|
---|
90 | return value.getResiduals();
|
---|
91 | }
|
---|
92 |
|
---|
93 | /** {@inheritDoc} */
|
---|
94 | public RealVector getPoint() {
|
---|
95 | return value.getPoint();
|
---|
96 | }
|
---|
97 | }
|
---|