version 1.1.1.2, 2000/01/22 14:15:57 |
version 1.1.1.3, 2003/09/15 07:09:24 |
|
|
static char *RCSid = "$Id$"; |
static char *RCSid = "$Id$"; |
#endif |
#endif |
|
|
|
/* NOTICE: Change of Copyright Status |
|
* |
|
* The author of this module, Carsten Grammes, has expressed in |
|
* personal email that he has no more interest in this code, and |
|
* doesn't claim any copyright. He has agreed to put this module |
|
* into the public domain. |
|
* |
|
* Lars Hecking 15-02-1999 |
|
*/ |
|
|
/* |
/* |
* Nonlinear least squares fit according to the |
* Nonlinear least squares fit according to the |
* Marquardt-Levenberg-algorithm |
* Marquardt-Levenberg-algorithm |
Line 609 static TBOOLEAN fit_interrupt() |
|
Line 619 static TBOOLEAN fit_interrupt() |
|
frame routine for the marquardt-fit |
frame routine for the marquardt-fit |
*****************************************************************/ |
*****************************************************************/ |
static TBOOLEAN regress(a) |
static TBOOLEAN regress(a) |
double a[]; |
double a[]; |
{ |
{ |
double **covar, *dpar, **C, chisq, last_chisq, lambda; |
double **covar, *dpar, **C, chisq, last_chisq, lambda; |
int iter, i, j; |
int iter, i, j; |
|
|
|
|
/* Initialize internal variables and 1st chi-square check */ |
/* Initialize internal variables and 1st chi-square check */ |
if ((res = marquardt(a, C, &chisq, &lambda)) == ERROR) |
if ((res = marquardt(a, C, &chisq, &lambda)) == ERROR) |
Eex("FIT: error occured during fit"); |
Eex("FIT: error occurred during fit"); |
res = BETTER; |
res = BETTER; |
|
|
show_fit(iter, chisq, chisq, a, lambda, STANDARD); |
show_fit(iter, chisq, chisq, a, lambda, STANDARD); |
|
|
} |
} |
|
|
if (res == ERROR) |
if (res == ERROR) |
Eex("FIT: error occured during fit"); |
Eex("FIT: error occurred during fit"); |
|
|
/* compute errors in the parameters */ |
/* compute errors in the parameters */ |
|
|
|
|
else { |
else { |
/* 2D fit, 2 ranges: second range is for *z*, not y: */ |
/* 2D fit, 2 ranges: second range is for *z*, not y: */ |
autorange_z = autorange_y; |
autorange_z = autorange_y; |
if (autorange_y & 1) |
/* HBB 20010926: Bug fixed. Checks were the wrong way round */ |
|
if (! (autorange_y & 1)) |
min_z = min_y; |
min_z = min_y; |
if (autorange_y & 2) |
if (! (autorange_y & 2)) |
max_z = max_y; |
max_z = max_y; |
} |
} |
} |
} |