From abd8bfc91ccb8bd56ffd6a4901ba478b6abcc2a6 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 13 Nov 2015 16:25:16 +0000 Subject: [PATCH] Minimizer: limit initialisation fix --- lib/Minimizer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Minimizer.cpp b/lib/Minimizer.cpp index 1e06b46..163dc96 100644 --- a/lib/Minimizer.cpp +++ b/lib/Minimizer.cpp @@ -25,7 +25,6 @@ using namespace Latan; // constructor ///////////////////////////////////////////////////////////////// Minimizer::Minimizer(const Index dim) -: Solver(dim) { resize(dim); } @@ -33,11 +32,21 @@ Minimizer::Minimizer(const Index dim) // access ////////////////////////////////////////////////////////////////////// void Minimizer::resize(const Index dim) { + const Index oldDim = getDim(); + Solver::resize(dim); highLimit_.conservativeResize(dim); lowLimit_.conservativeResize(dim); hasHighLimit_.conservativeResize(dim); hasLowLimit_.conservativeResize(dim); + if (dim > oldDim) + { + highLimit_.segment(oldDim, dim - oldDim).fill(0.); + highLimit_.segment(oldDim, dim - oldDim).fill(0.); + lowLimit_.segment(oldDim, dim - oldDim).fill(0.); + hasHighLimit_.segment(oldDim, dim - oldDim).fill(false); + hasLowLimit_.segment(oldDim, dim - oldDim).fill(false); + } } // limits //////////////////////////////////////////////////////////////////////