From 9680be4df765b3a044e6a5f425de4225f680dcc7 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 31 Oct 2011 13:44:02 +0100
Subject: [PATCH] Make bisection a parameter

---
 src/samplefunctional.hh | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh
index f4b95091..0a1dc654 100644
--- a/src/samplefunctional.hh
+++ b/src/samplefunctional.hh
@@ -119,7 +119,16 @@ template <int dimension> class SampleFunctional {
 
 template <class Functional>
 void minimise(const Functional J, const typename Functional::SmallVector x,
-              typename Functional::SmallVector &corr) {
+              typename Functional::SmallVector &corr,
+              Bisection const &bisection =
+                  Bisection(0.0, // acceptError: Stop if the search interval has
+                                 // become smaller than this number
+                            1.0, // acceptFactor: ?
+                            1e-12, // requiredResidual: ?
+                            true,  // fastQuadratic
+                            0))    // safety: acceptance factor for inexact
+                                   // minimization
+{
   typedef typename Functional::SmallVector SmallVector;
   SmallVector descDir;
   J.descentDirection(x, descDir);
@@ -165,12 +174,6 @@ void minimise(const Functional J, const typename Functional::SmallVector x,
            0); // We should not be minimising in this direction otherwise
   }
 
-  Bisection bisection(0.0,   // acceptError: Stop if the search interval has
-                             // become smaller than this number
-                      1.0,   // acceptFactor: ?
-                      1e-12, // requiredResidual: ?
-                      true,  // fastQuadratic
-                      0); // safety: acceptance factor for inexact minimization
   int count;
   // FIXME: The value of x_old should not matter if the factor is 1.0, correct?
   double const stepsize = bisection.minimize(JRest, 0.0, 1.0, count);
-- 
GitLab