On Wednesday, 27 Apr 2005 at 17:59 +0200, Peter Brommer wrote:
> I have included a patch for brent.c to implement the original algorithm as 
> published. Perhaps this is of any help to you.
I forgot to attach the patch in my earlier mail -- sorry for that...

regards,

Peter

-- 
------------------------------------------------------------------------
Peter Brommer                     Dipl.-Phys.
Institut f�r Theoretische und Angewandte Physik
Universit�t Stuttgart
Pfaffenwaldring 57, 6.347         Phone  +49 711 685 5267
70550 Stuttgart                   Fax    +49 711 685 5271
Germany                           email  [EMAIL PROTECTED]
--- brent.c.~1.12.~     2004-04-13 16:10:31.000000000 +0200
+++ brent.c     2005-04-27 17:31:25.000000000 +0200
@@ -164,16 +164,32 @@
         {
           *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;
+      }
+      else
+      {
+       return GSL_SUCCESS;
+      }
     }
-  else if (f_u < f_z)
+  else if (f_u <= f_z)
     {
       if (u < z)
         {
@@ -194,20 +210,6 @@
       *f_minimum = f_u;
       return GSL_SUCCESS;
     }
-  else 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;
-    }
   else
     {
       return GSL_FAILURE;

Attachment: pgpSJdajO6Rez.pgp
Description: PGP signature

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

Reply via email to