| x | N x D matrix of the positions to fit. Each matrix row is a D-dimensional position. |
| sigma_x | Uncertainty (one sigma, gaussian errors assumed) assosiated with x. Taking into account the uncertainty of the independent variable is currently unsupported, and this parameter must therefore be set to NULL. |
| y | The N values to fit. |
| sigma_y | Vector of size N containing the uncertainties of the y-values. If this parameter is NULL, constant uncertainties are assumed. |
| a | Vector containing M fit parameters. Must contain a guess solution on input and contains the best fit parameters on output. |
| ia | Array of size M defining which fit parameters participate in the fit (non-zero) and which fit parameters are held constant (zero). At least one element must be non-zero. Alternatively, pass NULL to fit all parameters. |
| f | Function that evaluates the fit function at the position specified by the first argument (an array of size D) using the fit parameters specified by the second argument (an array of size M). The result must be output using the third parameter, and the function must return zero iff the evaluation succeded. |
| dfda | Function that evaluates the first order partial derivatives of the fit function with respect to the fit parameters at the position specified by the first argument (an array of size D) using the parameters specified by the second argument (an array of size M). The result must be output using the third parameter (array of size M), and the function must return zero iff the evaluation succeded. |
| relative_tolerance | The algorithm converges by definition if the relative decrease in chi squared is less than tolerance tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_TOLERANCE |
| tolerance_count | The algorithm converges by definition if the relative decrease in chi squared is less than tolerance tolerance_count times in a row. Recommended default: CPL_FIT_LVMQ_COUNT |
| max_iterations | If this number of iterations is reached without convergence, the algorithm diverges, by definition. Recommended default: CPL_FIT_LVMQ_MAXITER |
| mse | If non-NULL, the mean squared error of the best fit is computed. |
| red_chisq | If non-NULL, the reduced chi square of the best fit is computed. This requires sigma_y to be specified. |
| covariance | If non-NULL, the formal covariance matrix of the best fit parameters is computed (or NULL on error). On success the diagonal terms of the covariance matrix are guaranteed to be positive. However, terms that involve a constant parameter (as defined by the input array ia) are always set to zero. Computation of the covariacne matrix requires sigma_y to be specified. |