VF_nonlinfit and VF_nonlinfitwW (OptiVec matrix function)">VF_nonlinfit, VF_nonlinfitwW">
VF_nonlinfit_... VD_nonlinfit_... VE_nonlinfit_...
VF_nonlinfitwW_... VD_nonlinfitwW_... VE_nonlinfitwW_...
..._autoDeriv
..._getChi2
..._getBestValues
..._getTestRun
..._getTestPar
..._getTestDir
..._stop
Functionhelper functions for VF_nonlinfit and VF_nonlinfitwW
Syntax C/C++#include <MFstd.h>
void VF_nonlinfit_autoDeriv( fVector dYdAi, fVector X, ui size, unsigned ipar, VF_NONLINFITWORKSPACE *ws );
float VF_nonlinfit_getChi2( VF_NONLINFITWORKSPACE *ws );
void VF_nonlinfit_getBestValues( fVector ABest, VF_NONLINFITWORKSPACE *ws );
int VF_nonlinfit_getTestDir( VF_NONLINFITWORKSPACE *ws );
unsigned VF_nonlinfit_getTestPar( VF_NONLINFITWORKSPACE *ws );
unsigned VF_nonlinfit_getTestRun( VF_NONLINFITWORKSPACE *ws );
void VF_nonlinfit_stop( VF_NONLINFITWORKSPACE *ws );

  (identical syntax for the VF_nonlinfitwW_... functions)
C++ MatObj#include <OptiVec.h>
void vector<T>::nonlinfit_getChi2( VF_NONLINFITWORKSPACE *ws );
void vector<T>::nonlinfit_getBestValues( VF_NONLINFITWORKSPACE *ws );
unsigned vector<T>::nonlinfit_getTestPar( VF_NONLINFITWORKSPACE *ws );
unsigned vector<T>::nonlinfit_getTestRun( VF_NONLINFITWORKSPACE *ws );
void vector<T>::nonlinfit_stop( VF_NONLINFITWORKSPACE *ws );

  (identical syntax for the VF_nonlinfitwW_... functions)
Pascal/Delphiuses VFnlfit;
procedure VF_nonlinfit_autoDeriv( dYdAi, X: fVector; size:UIntSize; ipar:UInt; PVF_NONLINFITWORKSPACE ws );
function VF_nonlinfit_getChi2( PVF_NONLINFITWORKSPACE ws ): Single;
procedure VF_nonlinfit_getBestValues( BestValues: fVector; PVF_NONLINFITWORKSPACE ws );
function VF_nonlinfit_getTestDir( PVF_NONLINFITWORKSPACE ws ): Integer;
function VF_nonlinfit_getTestPar( PVF_NONLINFITWORKSPACE ws ): UInt;
function VF_nonlinfit_getTestRun( PVF_NONLINFITWORKSPACE ws ): UInt;
procedure VF_nonlinfit_stop( PVF_NONLINFITWORKSPACE ws );

  (identical syntax for the VF_nonlinfitwW_... functions)
DescriptionVF_nonlinfit_autoDeriv performs a numerical differentiation of a user-provided y=f(x) 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 VF_NONLINFITWORKSPACE used in the current VF_nonlinfit 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.
VF_nonlinfit_getChi2 returns the best figure-of-merit (c2 or, for robust fits, |c|) obtained so far. If you call this function before VF_nonlinfit has had the chance to calculate c2, VF_nonlinfit_getChi2 returns -1.0.

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

VF_nonlinfit_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).

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

VF_nonlinfit_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.

VF_nonlinfit_stop makes VF_nonlinfit 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