#include "geoslib_old_f.h"#include "Matrix/MatrixSymmetric.hpp"#include "Basic/VectorHelper.hpp"#include "Basic/Utilities.hpp"#include "Basic/String.hpp"#include "Basic/OptDbg.hpp"#include "Core/Keypair.hpp"#include <math.h>Functions | |
| static void | st_gradient (VectorDouble ¶m, VectorDouble &lower, VectorDouble &upper, VectorDouble &scale, VectorDouble &tabwgt, MatrixDense &Jr, VectorDouble ¶m1, VectorDouble ¶m2, VectorDouble &tabmod1, VectorDouble &tabmod2) |
| static double | st_residuals (VectorDouble ¶m, VectorDouble &tabexp, VectorDouble &tabwgt, VectorDouble &tabmod, VectorDouble &residuals) |
| static void | st_determine_gauss (MatrixDense &Jr, MatrixSquare &gauss) |
| static double | st_norm_hgn (VectorDouble &hgn, VectorDouble &scale) |
| static double | st_essai (VectorDouble &hgnadm, VectorDouble &grad_red, MatrixSquare &gauss_red) |
| static int | st_solve_hgnc (int npar, const VectorDouble &grad, const MatrixSquare &gauss, VectorDouble &hgnc, int flaginvsign) |
| static void | st_fill_constraints (const MatrixDense &acont, VectorDouble &grad, MatrixSquare &gauss) |
| static int | st_calcul0 (VectorDouble ¶m, VectorDouble &lower, VectorDouble &upper, VectorDouble &scale, const MatrixDense &acont, VectorDouble &tabwgt, VectorDouble &residuals, MatrixDense &Jr, VectorDouble &grad, MatrixSquare &gauss, VectorDouble &hgnc, VectorDouble ¶m1, VectorDouble ¶m2, VectorDouble &tabmod1, VectorDouble &tabmod2) |
| static int | st_possibilities (int npar, MatrixDense &bords, VectorDouble &ai, VectorDouble &hgnc, VectorInt &flag, VectorDouble &temp) |
| static int | st_define_constraints (int mode, MatrixDense &bords_red, VectorDouble &ai_red, VectorDouble &hgnc, MatrixDense &consts, VectorInt &flag, VectorDouble &temp) |
| static void | st_minimum (VectorInt &, VectorInt &flag, MatrixDense &bords_red, const VectorDouble &top, const VectorDouble &bot, VectorDouble &hgnc, VectorDouble &hgnadm) |
| static void | st_update_bords (MatrixDense &bords, VectorInt &ind_util, MatrixDense &bords_red) |
| static int | st_suppress_unused_constraints (MatrixDense &bords, VectorDouble &ai, VectorDouble &grad, MatrixSquare &gauss, VectorDouble &hgnc, VectorInt &ind_util, MatrixDense &bords_red, VectorDouble &ai_red, VectorDouble &grad_red, MatrixSquare &gauss_red, VectorInt &flag1, VectorInt &flag2, VectorDouble &temp) |
| static int | st_establish_minimization (int nactive, VectorInt &ind_util, VectorInt &flag_active, MatrixDense &bords_red, VectorDouble &ai_red, VectorDouble &grad_red, MatrixSquare &gauss_red, int *lambda_neg, VectorDouble &hgnc, MatrixSquare &a, VectorDouble &b, VectorDouble &temp) |
| static void | st_check (VectorInt &ind_util, VectorDouble &hgnc, const MatrixDense &acont) |
| static int | st_minimization_under_constraints (VectorInt &ind_util, MatrixDense &bords_red, VectorDouble &ai_red, VectorDouble &grad_red, MatrixSquare &gauss_red, MatrixDense &consts, VectorDouble &hgnc, VectorDouble &hgnadm, VectorInt &flag_active, VectorInt &flag_actaux, MatrixSquare &a, VectorDouble &b1, VectorDouble &b2, VectorDouble &b3, VectorDouble &temp, const MatrixDense &acont) |
| static void | st_constraints_init (VectorInt &ind_util, VectorDouble &ai) |
| static void | st_define_bounds (VectorDouble ¶m, VectorDouble &lower, VectorDouble &upper, VectorDouble &scale, double delta, MatrixDense &bords) |
| static void | st_foxleg_debug_title (void) |
| static void | st_foxleg_debug_current (double mscur, double delta, VectorDouble ¶m) |
| static void | st_foxleg_score (const Option_AutoFit &mauto, double mscur, double delta, double arret) |
| static void | st_linear_interpolate (double mscur, VectorDouble ¶m, const MatrixDense &acont, VectorDouble &tabexp, VectorDouble &tabwgt, MatrixDense &bords, VectorDouble &grad, double *msaux, VectorDouble ¶maux, VectorDouble &residuals, VectorDouble &tabmod1) |
| static int | st_check_param (VectorDouble ¶m, VectorDouble &lower, VectorDouble &upper) |
| int | foxleg_f (int ndat, int npar, int ncont, const MatrixDense &acont, VectorDouble ¶m, VectorDouble &lower, VectorDouble &upper, VectorDouble &scale, const Option_AutoFit &mauto, int flag_title, void(*func_evaluate)(int ndat, int npar, VectorDouble ¶m, VectorDouble &work), VectorDouble &tabexp, VectorDouble &tabwgt) |
Variables | |
| static int | VERBOSE_GQO = 0 |
| static int | NPAR |
| static int | NPAR2 |
| static int | NPARAC |
| static int | NPARAC2 |
| static int | NDAT |
| static int | NCONT |
| static int | NPCT |
| static int | NPCT2 |
| static int | ITERATION |
| static int | SOUSITER |
| static void(* | FUNC_EVALUATE )(int ndat, int npar, VectorDouble ¶m, VectorDouble &work) |
| int foxleg_f | ( | int | ndat, |
| int | npar, | ||
| int | ncont, | ||
| const MatrixDense & | acont, | ||
| VectorDouble & | param, | ||
| VectorDouble & | lower, | ||
| VectorDouble & | upper, | ||
| VectorDouble & | scale, | ||
| const Option_AutoFit & | mauto, | ||
| int | flag_title, | ||
| void(*)(int ndat, int npar, VectorDouble ¶m, VectorDouble &work) | func_evaluate, | ||
| VectorDouble & | tabexp, | ||
| VectorDouble & | tabwgt | ||
| ) |
Foxleg algorithm
| [in] | ndat | Number of control points |
| [in] | npar | Number of parameters to estimate |
| [in] | ncont | Number of additional constraints |
| [in] | acont | Matrix of additional constraints (Dimension = ncont * npar) |
| [in] | param | Current values of the parameters |
| [in] | lower | Array of lower values |
| [in] | upper | Array of upper values |
| [in] | scale | Array of scale |
| [in] | mauto | Option_AutoFit structure |
| [in] | flag_title | Print the title after func_evaluate() |
| [in] | func_evaluate | Function for evaluating the model |
| [in] | tabexp | Array of values at control points |
| [in] | tabwgt | Array of weights at control points |
|
static |
Evaluate Gradient and Hermitian matrices
| [in] | param | Current values of the parameters |
| [in] | lower | Array of lower values |
| [in] | upper | Array of upper values |
| [in] | scale | Array of scaling values |
| [in] | acont | Array of constraints |
| [in] | tabwgt | Array of weights at control points |
| [out] | residuals | Array of residuals |
| [out] | Jr | Array of gradients |
| [out] | grad | Gradient matrix |
| [out] | gauss | Gauss matrix |
| [out] | hgnc | Resulting hgnc array |
| [out] | param1 | Working array (Dimension: NPAR) |
| [out] | param2 | Working array (Dimension: NPAR) |
| [out] | tabmod1 | Working array (Dimension: NDAT) |
| [out] | tabmod2 | Working array (Dimension: NDAT) |
|
static |
Check that the algorithm is valid
| [in] | ind_util | List of retained constraint indices |
| [in] | hgnc | Working vector |
| [in] | acont | Matrix of additional constraints |
|
static |
|
static |
Initialize the constraints
| [in] | ind_util | List of retained constraint indices |
| [in] | ai | AI matrix |
|
static |
|
static |
Calculate the number of constraints
| [in] | mode | Type of constraints
|
| [in] | bords_red | Reduced array containing the bounds |
| [in] | ai_red | Reduced AI matrix |
| [in] | hgnc | Resulting hgnc array |
| [out] | consts | Array of constraints |
| [out] | flag | Array of indices with zero valid constraint |
| [out] | temp | Working array |
|
static |
Calculate the Gauss matrix
| [in] | Jr | Array of gradients |
| [out] | gauss | Gaussian matrix |
|
static |
Score of the Minimization under constraints
| [in] | hgnadm | Admissible vector |
| [in] | grad_red | Reduced Gradient matrix |
| [in] | gauss_red | Reduced Gauss matrix |
|
static |
Minimization under constraints
| [in] | nactive | Number of active constraints |
| [in] | ind_util | List of retained constraint indices |
| [in] | flag_active | Array of indices with zero valid constraint |
| [in] | bords_red | Reduced array containing the bounds |
| [in] | ai_red | Reduced AI matrix |
| [in] | grad_red | Reduced Gradient matrix |
| [in] | gauss_red | Reduced Gauss matrix |
| [out] | lambda_neg | Index of the first negative lambda value |
| [out] | hgnc | Resulting Hgnc array |
| [out] | a | Minimization L.H.S. matrix |
| [out] | b | Minimization R.H.S. matrix |
| [out] | temp | Working array |
|
static |
Add ncont linear constraints (AX=B) to the linear system (of size npar) used for quadratic optimization
| [in] | acont | Matrix A |
| [out] | grad | left hand-side of the system |
| [out] | gauss | matrix of the system |
|
static |
Display the current status for FOXLEG trace
|
static |
Display the title for FOXLEG trace
|
static |
Display the FOXLEG score
|
static |
Calculate the gradient
| [in] | param | Current values of the parameters |
| [in] | lower | Array of lower values |
| [in] | upper | Array of upper values |
| [in] | scale | Array of scaling values |
| [in] | tabwgt | Array of weights |
| [out] | Jr | Array of gradients |
| [out] | param1 | Working array (Dimension: NPAR) |
| [out] | param2 | Working array (Dimension: NPAR) |
| [out] | tabmod1 | Working array (Dimension: NDAT) |
| [out] | tabmod2 | Working array (Dimension: NDAT) |
|
static |
Interpolate linearly the vector of parameters
| [in] | mscur | Current minimization value |
| [in] | param | Current values of the parameters |
| [in] | acont | Array of constraints |
| [in] | tabexp | Array of values at control points |
| [in] | tabwgt | Array of weights at control points |
| [in] | bords | Array containing the bounds |
| [in] | grad | Gradient matrix |
| [out] | msaux | New minimization value |
| [out] | paramaux | New vector of parameters |
| [out] | residuals | Array of residuals |
| [out] | tabmod1 | Working array (Dimension: NDAT) |
|
static |
Minimization under constraints
| [in] | ind_util | List of retained constraint indices |
| [in] | bords_red | Reduced array containing the bounds |
| [in] | ai_red | Reduced AI matrix |
| [in] | grad_red | Reduced Gradient matrix |
| [in] | gauss_red | Reduced Gauss matrix |
| [out] | consts | Array of constraints |
| [out] | hgnc | Working vector |
| [out] | hgnadm | Working array |
| [out] | flag_active | Array of indices with zero valid constraint |
| [out] | flag_actaux | Array of indices with negative valid constraint |
| [out] | a | Minimization L.H.S. matrix |
| [out] | b1 | Minimization R.H.S. matrix |
| [out] | b2 | Minimization R.H.S. matrix |
| [out] | b3 | Minimization R.H.S. matrix |
| [out] | temp | Working array |
| [out] | acont | Constraint array |
|
static |
Calculate the minimum of the criterion and update hgnadm
| [in] | flag | Array of indices with negative valid constraint |
| [in] | bords_red | Reduced array containing the bounds |
| [in] | top | Calculated top of the fraction |
| [in] | bot | Calculated bottom of the fraction |
| [in] | hgnc | Hgnc array |
| [out] | hgnadm | Admissible Hgn array |
|
static |
Calculate the Norm of the HGN vector
| [in] | hgn | Working vector |
| [in] | scale | Scaling values |
|
static |
Calculate the number of new inactive constraints
| [in] | npar | Current number of parameters |
| [in] | bords | Array containing the bounds |
| [in] | ai | AI matrix |
| [in] | hgnc | Resulting hgnc array |
| [out] | flag | Working array |
| [out] | temp | Working array |
|
static |
Calculate the residuals between the model and the experimental
|
static |
Solve the direct minimization problem
| [in] | npar | Current number of parameters |
| [in] | grad | Gradient matrix |
| [in] | gauss | Gauss matrix |
| [in] | hgnc | Resulting hgnc array |
| [in] | flaginvsign | if 1, the result is multiplied by -1 |
|
static |
Eliminate the useless constraints
| [in] | bords | Array containing the bounds |
| [in] | ai | AI matrix |
| [in] | grad | Gradient matrix |
| [in] | gauss | Gaussian matrix |
| [in] | hgnc | hgnc array |
| [out] | ind_util | List of retained constraint indices |
| [out] | bords_red | Reduced Bounds array |
| [out] | ai_red | Reduced AI matrix |
| [out] | grad_red | Reduced Gradient matrix |
| [out] | gauss_red | Reduced Gauss matrix |
| [out] | flag1 | Working array |
| [out] | flag2 | Working array |
| [out] | temp | Working array |
|
static |
Update the constraints when no move has been performed
| [in] | bords | Array containing the bounds |
| [in] | ind_util | List of retained constraint indices |
| [out] | bords_red | Reduced Bounds array |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |