From 0e232a1db450d08a662be16279607730b049eb4d Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Wed, 10 Feb 2016 13:03:22 -0200 Subject: Fixed issue #20; also removed some unused #include. --- manipulationhandler.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'manipulationhandler.cpp') diff --git a/manipulationhandler.cpp b/manipulationhandler.cpp index 707d4c7..5bd916a 100644 --- a/manipulationhandler.cpp +++ b/manipulationhandler.cpp @@ -1,10 +1,6 @@ #include "manipulationhandler.h" #include -#include -#include - -#include #include "mp.h" #include "numericrange.h" @@ -13,8 +9,12 @@ ManipulationHandler::ManipulationHandler(const arma::mat &X, const arma::uvec &cpIndices) : m_X(X) , m_Y(X.n_rows, 2) + , m_firstY(X.n_rows, 2) + , m_prevY(X.n_rows, 2) , m_cpIndices(cpIndices) , m_rpIndices(X.n_rows - cpIndices.n_elem) + , m_hasFirst(false) + , m_hasPrev(false) , m_technique(TECHNIQUE_LAMP) { NumericRange range(0, m_X.n_rows); @@ -32,7 +32,10 @@ void ManipulationHandler::setTechnique(ManipulationHandler::Technique technique) void ManipulationHandler::setCP(const arma::mat &Ys) { - m_prevY = m_Y; + if (m_hasFirst) { + m_prevY = m_Y; + m_hasPrev = true; + } switch (m_technique) { case TECHNIQUE_PLMP: @@ -52,7 +55,8 @@ void ManipulationHandler::setCP(const arma::mat &Ys) break; } - if (m_firstY.n_rows != m_Y.n_rows) { + if (!m_hasFirst) { + m_hasFirst = true; m_firstY = m_Y; } @@ -63,7 +67,7 @@ void ManipulationHandler::setCP(const arma::mat &Ys) void ManipulationHandler::setRewind(double t) { - if (m_prevY.n_rows != m_Y.n_rows) { + if (!m_hasPrev) { return; } -- cgit v1.2.3