Hi everyone,

Nelder Mead , i.e. simplex search has a bug. In the function
static int
nmsimplex_iterate (void *vstate, gsl_multimin_function * f,
                   gsl_vector * x, double *size, double *fval)

in multimin/simplex.c
a piece of code that determines the highest , second highest and lowest
vertex fails when first value in y1 is the highest.
It returns second highest equal to the highest. Later that influence
decision in the algorithm.

FIX:
add lines:
  ds_hi = gsl_vector_get (y1, 1);
  s_hi = 1;
before the loop

CODE SHOULD LOOK LIKE THIS:

...
 if (xc->size != x->size)
    {
      GSL_ERROR("incompatible size of x", GSL_EINVAL);
    }

  /* get index of highest, second highest and lowest point */

  dhi = ds_hi = dlo = gsl_vector_get (y1, 0);
  ds_hi = gsl_vector_get (y1, 1);
  s_hi = 1;
  for (i = 1; i < n; i++)
    {
      val = (gsl_vector_get (y1, i));
      if (val < dlo)
        {
          dlo = val;
          lo = i;
        }
...

Cheers,

Michal Kuklik
_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to