|
From: Carl M. <mi...@ph...> - 2013-03-12 06:25:24
|
On Sun, 10 Mar 2013, sfeam (Ethan Merritt) wrote:
> On Friday, 08 March 2013, Carl Michal wrote:
>
> The code in the patch does not do what it is described as doing.
>
> 1)
> The test of this form will never be true: (foo == NEARLY_ZERO)
> You would have to test (favs(foo) <= NEARLY_ZERO)
I disagree because in fit.c just a couple of lines up, there is this:
for (i = 0; i < num_params; i++)
if (a[i] == 0)
a[i] = NEARLY_ZERO;
So I tested for NEARLY_ZERO. I think this is nearly the right behaviour,
because if a parameter is specifically initialized to something
smaller than NEARLY_ZERO, then prescaling is probably particularly
important. There is one minor issue though - if the user
purposefully initializes a variable to the value of NEARLY_ZERO it
won't prescale but should. I've fixed that.
>
> 2)
> The description/comment says
> "If any variables were 0, then don't do it, since it causes more harm than
> good then."
> But the actual code applies scaling to all parameters except ones
> with (foo == NEARLY_ZERO), which aside from being the wrong test is
> not what is described ("if any ...").
>
> Also, do you have any reason to believe the current definition of
> NEARLY_ZERO as 10^{-30} is the right place to make a cutoff?
The comment has been fixed so it now describes the actual behaviour. I
don't want a cutoff - just not to scale if the variable was set to exactly
0.
>
> 3)
> Please make this an option, probably
> set fit [no]prescale
>
> Ethan
Done.
This now uses set fit [no]prescale, defaults to off, and is unset in
unset fit. The value is also displayed by show fit, and is saved in
save.c.
The documentation describes the new option in help fit, help fit tips, and
help set fit.
Is there anything I've missed?
I've also picked up a couple of modifications that Bastian Maerkisch made
to the patch: it preserves the sign of the parameter and also scales the
outputs of the errors if the errors are saved to variables. There are now
two versions of the patch at
https://sourceforge.net/p/gnuplot/patches/507/ one against 4.6.1 and one
against current CVS.
Thanks for the feedback.
Carl
|