lmmin_fit.h.html mathcode2html   
 Source file:   lmmin_fit.h
 Converted:   Tue Apr 17 2012 at 11:03:37
 This documentation file will not reflect any later changes in the source file.

$$\phantom{******** If you see this on the webpage then the browser could not locate *********}$$
$$\phantom{******** jsMath/easy/load.js or the variable root is set wrong in this file *********}$$
$$\newcommand{\vector}[1]{\left[\begin{array}{c} #1 \end{array}\right]}$$ $$\newenvironment{matrix}{\left[\begin{array}{cccccccccc}} {\end{array}\right]}$$ $$\newcommand{\A}{{\cal A}}$$ $$\newcommand{\W}{{\cal W}}$$

#ifndef LMMIN_FIT_H
#define LMMIN_FIT_H

 
// Curve fitting with Levenburg-Marquardt minimization. //

Up: Index //

#include "qubfast.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef void (*lmmin_CurveFunc)(void *obj, double *params, float *ff);
typedef int (*lmmin_IterFunc)(void *obj, double *params, int iter);

QUBFAST_API int qub_lmmin_fit(lmmin_CurveFunc curve, int Nparam, double *params, double *lo, double *hi, int *can_fit,
			      int Ndata, float *yy, float *ww, lmmin_IterFunc on_iter, callbk_reportfun on_report, void *obj,
			      int max_iter, double toler, float *ff, double *ssr);
/*
Finds param values which minimize the sum-squared residual between curve and yy data;
optionally weighted by multiplying the residuals by ww.

    @param curve:     void curve(void *obj, double *params, float *ff)
                      evaluates curve at params into ff
    @param Nparam:    number of curve params
    @param params:    starting/final value of params
    @param lo:        low bound on params, or UNSET_VALUE
    @param hi:        high bound on params, or UNSET_VALUE
    @param can_fit:   nonzero if param should be fit
    @param Ndata:     number of data points
    @param yy:        data y values
    @param ww:        data weights to multiply by residuals (1.0 for even weighting)
    @param on_iter:   int on_iter(void *obj, double *params, float *ff)
                      returns zero to stop immediately
    @param on_report: int on_report(const char *msg, void *obj)
    @param obj:       for callback functions
    @param max_iter:  max iterations
    @param toler:     stop when it gets this close
    @param ff:        output array for fit samples
    @param ssr:       pointer to output sum-squared-residual
    
    @returns:         number of iterations
*/


#ifdef __cplusplus
}
#endif

#endif