help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] brent minimization


From: John Pye
Subject: Re: [Help-gsl] brent minimization
Date: Sat, 05 Jan 2008 14:38:30 +1100
User-agent: Thunderbird 2.0.0.6 (X11/20071022)

Hi Andrew,

Not sure if this helps or not; here is another implementation of the
Brent algorithm that might be useful for comparison. I based it on the
code in brent.shar from netlib:

http://freesteam.cvs.sourceforge.net/freesteam/freesteam/zeroin.h?view=markup

Cheers
JP

Andrew W. Steiner wrote:
> I probably have a case of the stupids today...but just in case I don't,
> here's a question. There seems to be a whole section of
> unreachable code in brent.c (see below)
> since the first if-else construct always returns, so the next if-else
> construct is never executed. Is this intentional?
>
> Take care,
> Andrew
>
> gsl-1.10:brent.c (beginning at line 184):
>
>     if (u < z)
>         {
>           *x_lower = u;
>           *f_lower = f_u;
>           return GSL_SUCCESS;
>         }
>       else
>         {
>           *x_upper = u;
>           *f_upper = f_u;
>           return GSL_SUCCESS;
>         }
>
>       if (f_u <= f_w || w == z)
>         {
>           state->v = w;
>           state->f_v = f_w;
>           state->w = u;
>           state->f_w = f_u;
>           return GSL_SUCCESS;
>         }
>       else if (f_u <= f_v || v == z || v == w)
>         {
>           state->v = u;
>           state->f_v = f_u;
>           return GSL_SUCCESS;
>         }
>
> -----------
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>   





reply via email to

[Prev in Thread] Current Thread [Next in Thread]