IDMFitterEvents Interface

Version: 2.0
Events interface for DMFitter Object

GUID: {673AB003-9A0B-11D4-B2A4-FD6847C75367}

This interface should be used to receive notifications from DMFitter ActiveX control. NLSF operations are extremely processor-intensive and may take a lot of time. DMFitter object fires OnProgress event every time when it finishes LM iteration, providing you with a number of completed iterations and current values of fitting parameters. So that, you can easily create animated visual feedback for your users (see TestAniLMFit.* demos for more details).

Also you can use event handlers to perform analytical calculations of user-defined linear basis functions (see TestLinearEFit.htm demo) and NLSF function and partial derivatives (TestLMFitEvents.htm and TestLMFitEJS.htm).

Kind Name ID Description
OnProgress 201 Fire when LM fitting iteration completed
OnGetLinearBasis 202 Return linear fitter basis terms
OnGetLMFunction 203 Return LM fitter function
OnGetLMDerivative 204 Return LM fitter derivative

event OnProgress: HResult

This event may be used to monitor progress of LM fitting. It is fired by LM fitter after each iteration. You can analyze values of Iterations and Parameters properties in the event handler procedure. For more compatibility, this event has no parameters.

Notice that for LMFitter object this event is not invoked if fitting object is assigned to Expression property (instead you may display progress in the CalculateFunction member of the fitting object as demonstrated in the TestLMFitter.htm sample). Iterations number obtained inside the OnProgress event handler may be greater than actual.

event OnGetLinearBasis(X, Term, Result): HResult

You need to define this event handler if you wish to calculate linear basis terms analytically. X is an independent variable (double precision float), Term is an integer index of basis term counted from 1 (see TestLinearEFit.htm demo).

event OnGetLMFunction(X, Parameters, Result): HResult

This event handler must return the value of NLSF model function. X is an independent variable (array or single double precision float), Parameters is of type OleVariant and contains array of double precision values of fitting parameters. Notice that X is always of type OleVariant and if you set 2D array for X property, X parameter will be an array with appropriate number of elements.

event OnGetLMDerivative(X, Parameters, Sigmas, Result): HResult

You define this event handler if you wish to calculate LM partial derivatives analytically. X and Parameters are the same as in OnGetLMFunction, Sigmas is of type OleVariant and contains array of double precision values of parameter fix flags: if Sigmas[I]<0, you can leave zero value of appropriate partial derivative. You must return an array of double precision values of partial derivatives. See TestLMFitEvents.htm and TestLMFitEJS.htm examples for more details.