/* $Id: cpl_fit.h,v 1.1 2007/05/09 09:28:17 yjung Exp $ * * This file is part of the ESO Common Pipeline Library * Copyright (C) 2001-2004 European Southern Observatory * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * $Author: yjung $ * $Date: 2007/05/09 09:28:17 $ * $Revision: 1.1 $ * $Name: $ */ #ifndef CPL_FIT_H #define CPL_FIT_H /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ #include #include #include #include CPL_BEGIN_DECLS /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ /* * Default parameter values for * Levenberg-Marquardt fitting */ #ifndef CPL_FIT_LVMQ_TOLERANCE #define CPL_FIT_LVMQ_TOLERANCE 0.01 #endif /* Should be << 1. (A relative decrease in chi squared << 1 is not statistically significant so there is no point in converging to machine precision.) */ #ifndef CPL_FIT_LVMQ_COUNT #define CPL_FIT_LVMQ_COUNT 5 #endif /* Should be somewhat greater than 1 */ #ifndef CPL_FIT_LVMQ_MAXITER #define CPL_FIT_LVMQ_MAXITER 1000 #endif /* Should be >> 1 */ /*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code cpl_fit_lvmq(const cpl_matrix *x, const cpl_matrix *sigma_x, const cpl_vector *y, const cpl_vector *sigma_y, cpl_vector *a, const int ia[], int (*f)(const double x[], const double a[], double *result), int (*dfda)(const double x[], const double a[], double result[]), double relative_tolerance, int tolerance_count, int max_iterations, double *mse, double *red_chisq, cpl_matrix **covariance); cpl_imagelist * cpl_fit_imagelist_polynomial(const cpl_vector *, const cpl_imagelist *, int, int, cpl_boolean, cpl_type, cpl_image *); CPL_END_DECLS #endif /* end of cpl_fit.h */