MF_multiNonlinfit and MF_multiNonlinfitwW (OptiVec matrix function)">MF_multiNonlinfit, MF_multiNonlinfitwW">
MF_multiNonlinfit_... MD_multiNonlinfit_... ME_multiNonlinfit_...
MF_multiNonlinfitwW_... MD_multiNonlinfitwW_... ME_multiNonlinfitwW_...
..._autoDeriv
..._getChi2
..._getChi2Detail
..._getBestValues
..._getTestRun
..._getTestPar
..._getTestDir
..._stop
Functionhelper functions for MF_multiNonlinfit and MF_multiNonlinfitwW
Syntax C/C++#include <MFstd.h>
void MF_multiNonlinfit_autoDeriv( fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iex, MF_NONLINFITWORKSPACE *ws );
float MF_multiNonlinfit_getChi2( MF_NONLINFITWORKSPACE *ws );
void MF_multiNonlinfit_getChi2Detail( fVector Chi2Detail, MF_NONLINFITWORKSPACE *ws ); void MF_multiNonlinfit_getBestValues( fVector ABest, MF_NONLINFITWORKSPACE *ws );
int MF_multiNonlinfit_getTestDir( MF_NONLINFITWORKSPACE *ws );
unsigned MF_multiNonlinfit_getTestPar( MF_NONLINFITWORKSPACE *ws );
unsigned MF_multiNonlinfit_getTestRun( MF_NONLINFITWORKSPACE *ws );
void MF_multiNonlinfit_stop( MF_NONLINFITWORKSPACE *ws );

  (identical syntax for the MF_nonlinfitwW_... functions)
Pascal/Delphiuses MFmnlfit;
procedure MF_multiNonlinfit_autoDeriv( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar, iex: UInt; PMF_NONLINFITWORKSPACE ws );
function MF_multiNonlinfit_getChi2( PMF_NONLINFITWORKSPACE ws ): Single;
procedure MF_multiNonlinfit_getChi2Detail( Chi2Detail:fVector; PMF_NONLINFITWORKSPACE ws );
procedure MF_multiNonlinfit_getBestValues( BestValues: fVector; PMF_NONLINFITWORKSPACE ws );
function MF_multiNonlinfit_getTestDir( PMF_NONLINFITWORKSPACE ws ): Integer;
function MF_multiNonlinfit_getTestPar( PMF_NONLINFITWORKSPACE ws ): UInt;
function MF_multiNonlinfit_getTestRun( PMF_NONLINFITWORKSPACE ws ): UInt;
procedure MF_multiNonlinfit_stop( PMF_NONLINFITWORKSPACE ws);

  (identical syntax for the MF_multiNonlinfitwW_... functions)
DescriptionMF_multiNonlinfit_autoDeriv performs a numerical differentiation of a user-provided z=f(x,y) model function with respect to the parameter aipar of the model. All necessary information (model function, current state of parameter set, etc.) is passed to this function through the pointer to the MF_NONLINFITWORKSPACE used in the current MF_multiNonlinfit operation.

The following functions allow to monitor the progress of a nonlinear fitting operation. They can either be called from within the provided model function or, for multi-thread applications, from a second thread running in parallel to the thread containing the fitting function.
MF_multiNonlinfit_getChi2 returns the best figure-of-merit (c2 or, for robust fits, |c|) obtained so far. If you call this function before MF_multiNonlinfit has had the chance to calculate c2, MF_multiNonlinfit_getChi2 returns -1.0.

MF_multiNonlinfit_getChi2Detail fills the user-supplied vector Chi2Detail with the individual figures-of-merit (c2iex or, for robust fits, |ciex|) for all experiments. The sum over these individual c2iex or |ciex| values is the best c2 (or |c|) obtained so far, as returned by MF_multiNonlinfit_getChi2.

MF_multiNonlinfit_getBestValues stores the best parameters ai obtained so far into the user-supplied vector ABest.

MF_multiNonlinfit_getTestDir returns the test direction (+1 for upwards, -1 for downwards) during "breakout" attempts from possible local optima which would otherwise prevent the routine from finally reaching the global optimum (level-of-method greater than 3 specified by VF_setNonlinfitOptions).

MF_multiNonlinfit_getTestPar returns the index of the parameter currently under "breakout" investigation.

MF_multiNonlinfit_getTestRun returns the index of the current "breakout" test run. For each fitted parameter, one test run is performed. The order in which the parameters are checked is determined internally in such a way as to test the most sensitive parameters first.

MF_multiNonlinfit_stop makes MF_multiNonlinfit finish its current Levenberg-Marquardt or Downhill-Simplex cycle, update the output parameters and return. Thereby, long fitting sessions (especially tedious "break-out" attempts) may be broke off without the loss of any data.

See alsochapter 13

MatrixLib Table of Contents  OptiVec home