2.2.1.1.1 NLFitContext::GetFitCurrInfo

Description

It provides the information about the current evaluation state. See NLSFCURRINFO for more info.

Syntax

BOOL GetFitCurrInfo( NLSFCURRINFO * pCurrInfo )

Parameters

pCurrInfo
[output]*pCurrInfo receives the info about the current evaluation state.

Return

TRUE if success.

Examples

EX1

#include <ONLSF.h>
#include <..\Originlab\fft.h>
void NLFitContext_GetFitCurrInfo_ex1(double y0, double A, double t, double x, double& y)
{
    Worksheet wks = Project.ActiveLayer();
    NLFitContext *pCtxt = Project.GetNLFitContext();
    if ( pCtxt )
    {
        static vector vSignal;
        BOOL bIsNewParamValues = pCtxt->IsNewParamValues();
        if ( bIsNewParamValues )
        {
            Dataset dsResponse(wks, 2);
            Dataset dsSampling(wks, 0);
            int iSize = dsSampling.GetSize();
            
            vector vResponse, vSample;
            vSignal.SetSize(iSize);
            vResponse.SetSize(iSize);
            vSample.SetSize(iSize);
            
            vResponse = dsResponse;
            vSample = dsSampling;
            
            vSignal = A * exp( -t*vSample );
            int iRet = fft_fft_convolution(iSize, vSignal, vResponse);            
        }
        
        NLSFCURRINFO    stCurrInfo;
        pCtxt->GetFitCurrInfo(&stCurrInfo);
        int nCurrentIndex = stCurrInfo.nCurrDataIndex;        
        if( nCurrentIndex < pCtxt->GetNumDatasetSets() )
        {
            error_report("Error, found invalid data index");
            return;
        }
        
        vector vData;
        pCtxt->GetIndepData(&vData);
 
        y = vData[nCurrentIndex] * x + vSignal[nCurrentIndex] + y0;
    }
}

Remark

See Also

NLFitContext::IsNewParamValues, NLFitContext::GetNumDatasetSets

Header to Included

ONLSF.h