Mantid
Loading...
Searching...
No Matches
Workspaces.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidCurveFitting/DllConfig.h"
11
12#include <limits>
13
14namespace Mantid {
15namespace CurveFitting {
16namespace NLLS {
17
18namespace {
19
20const double TEN_M3 = 1.0e-3;
21const double TEN_M5 = 1.0e-5;
22const double TEN_M8 = 1.0e-8;
23const double HUNDRED = 100.0;
24const double TEN = 10.0;
25const double POINT9 = 0.9;
26const double ZERO = 0.0;
27const double ONE = 1.0;
28const double TWO = 2.0;
29const double HALF = 0.5;
30const double SIXTEENTH = 0.0625;
31} // namespace
32
34
35 // M A I N R O U T I N E C O N T R O L S !!!
36
38 int maxit = 100;
39
46 int model = 3;
47
53 int nlls_method = 4;
54
56 int lls_solver = 1;
57
63 double stop_g_absolute = TEN_M5;
64 double stop_g_relative = TEN_M8;
65
68
74
77 double initial_radius = HUNDRED;
78
80 double maximum_radius = 1.0e8; // ten ** 8
81
88 double eta_successful = 1.0e-8; // ten ** ( - 8 )
89 double eta_success_but_reduce = 1.0e-8; // ten ** ( - 8 )
90 double eta_very_successful = POINT9;
91 double eta_too_successful = TWO;
92
99 double radius_increase = TWO;
100 double radius_reduce = HALF;
101 double radius_reduce_max = SIXTEENTH;
102
107
109 double hybrid_switch = 0.1;
110
114
119
125 int scale = 1;
126 double scale_max = 1e11;
127 double scale_min = 1e-11;
128 bool scale_trim_min = true;
129 bool scale_trim_max = true;
131 bool calculate_svd_J = false;
132
135 double more_sorensen_shift = 1e-13;
136 double more_sorensen_tiny = 10.0 * std::numeric_limits<double>::epsilon();
137 double more_sorensen_tol = 1e-3;
138
139 // H Y B R I D C O N T R O L S
140
143 double hybrid_tol = 2.0;
144
148
149 // O U T P U T C O N T R O L S !!!
150
153
154}; // struct nlls_options
155
158
160 int iter;
161
163 int f_eval = 0;
164
166 int g_eval = 0;
167
169 int h_eval = 0;
170
173
176
179
182
185
188
191 double obj = std::numeric_limits<float>::max();
192
195 double norm_g = std::numeric_limits<float>::max();
196
198 double scaled_g = std::numeric_limits<float>::max();
199
200}; // END TYPE nlls_inform
201
202// define types for workspace arrays.
203
213};
214
219};
220
224 double md_gn = 0.0;
225};
226
231};
232
238};
239
243};
244
248};
249
252 int first_call = 1;
253 int iter = 0;
256 double Delta;
257 double normd;
260 double hybrid_tol = 1.0;
261 double tr_nu = 2.0;
262 int tr_p = 3;
275 void initialize(int n, int m, const nlls_options &options);
276};
277
278} // namespace NLLS
279} // namespace CurveFitting
280} // namespace Mantid
Helper class which provides the Collimation Length for SANS instruments.
all workspaces called from the top level
Definition: Workspaces.h:251
NLLS_workspace()
Constructor of the workspace.
Definition: Workspaces.cpp:14
void initialize(int n, int m, const nlls_options &options)
Initialize the workspace.
Definition: Workspaces.cpp:22
workspace for subroutine allEigSymm
Definition: Workspaces.h:241
workspace for subroutine evaluateModel
Definition: Workspaces.h:222
workspace for subroutine getSvdJ
Definition: Workspaces.h:246
workspace for subroutine max_eig
Definition: Workspaces.h:205
workspace for subroutine min_eig_work
Definition: Workspaces.h:234
inform derived type with component defaults
Definition: Workspaces.h:157
double norm_g
the norm of the gradient of the objective function at the best estimate of the solution determined by...
Definition: Workspaces.h:195
DoubleFortranVector smallest_sv
vector of smallest singular values
Definition: Workspaces.h:184
int convergence_normf
test on the size of f satisfied?
Definition: Workspaces.h:172
DoubleFortranVector largest_sv
vector of largest singular values
Definition: Workspaces.h:187
int f_eval
the total number of evaluations of the objective function
Definition: Workspaces.h:163
double obj
the value of the objective function at the best estimate of the solution determined by NLLS_solve
Definition: Workspaces.h:191
DoubleFortranVector gradvec
vector of gradients
Definition: Workspaces.h:181
double scaled_g
the norm of the gradient, scaled by the norm of the residual
Definition: Workspaces.h:198
int g_eval
the total number of evaluations of the gradient of the objective function
Definition: Workspaces.h:166
int iter
the total number of iterations performed
Definition: Workspaces.h:160
DoubleFortranVector resvec
vector of residuals
Definition: Workspaces.h:178
int convergence_normg
test on the size of the gradient satisfied?
Definition: Workspaces.h:175
int h_eval
the total number of evaluations of the Hessian of the objective function
Definition: Workspaces.h:169
double eta_successful
a potential iterate will only be accepted if the actual decrease f - f(x_new) is larger than ....
Definition: Workspaces.h:88
int model
specify the model used.
Definition: Workspaces.h:46
int relative_tr_radius
should we scale the initial trust region radius?
Definition: Workspaces.h:67
int scale
scale the variables? 0 - no scaling 1 - use the scaling in GSL (W s.t.
Definition: Workspaces.h:125
int maxit
the maximum number of iterations performed
Definition: Workspaces.h:38
int nlls_method
specify the method used to solve the trust-region sub problem 1 Powell's dogleg 2 AINT method (of Yuj...
Definition: Workspaces.h:53
int more_sorensen_maxits
M O R E - S O R E N S E N C O N T R O L S.
Definition: Workspaces.h:134
int tr_update_strategy
Trust region update strategy 1 - usual step function 2 - continuous method of Hans Bruun Nielsen (IMM...
Definition: Workspaces.h:106
double stop_g_absolute
overall convergence tolerances.
Definition: Workspaces.h:63
bool output_progress_vectors
Shall we output progess vectors at termination of the routine?
Definition: Workspaces.h:152
int lls_solver
which linear least squares solver should we use?
Definition: Workspaces.h:56
double maximum_radius
maximum permitted trust-region radius
Definition: Workspaces.h:80
double initial_radius_scale
if relative_tr_radius == 1, then pick a scaling parameter Madsen, Nielsen and Tingleff say pick this ...
Definition: Workspaces.h:73
double radius_increase
on very successful iterations, the trust-region radius will be increased by the factor ....
Definition: Workspaces.h:99
double hybrid_tol
what's the tolerance such that ||J^T f || < tol * 0.5 ||f||^2 triggers a switch
Definition: Workspaces.h:143
int hybrid_switch_its
how many successive iterations does the above condition need to hold before we switch?
Definition: Workspaces.h:147
double initial_radius
if relative_tr_radius /= 1, then set the initial value for the trust-region radius (-ve => ||g_0||)
Definition: Workspaces.h:77
bool subproblem_eig_fact
use a factorization (dsyev) to find the smallest eigenvalue for the subproblem solve?...
Definition: Workspaces.h:118
bool exact_second_derivatives
shall we use explicit second derivatives, or approximate using a secant method
Definition: Workspaces.h:113
double hybrid_switch
if model=7, then the value with which we switch on second derivatives
Definition: Workspaces.h:109
workspace for subroutine solve_LLS
Definition: Workspaces.h:228
workspace for subroutine solve_general
Definition: Workspaces.h:216