aboutsummaryrefslogtreecommitdiff
path: root/manipulationhandler.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-10 13:03:22 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-10 13:03:22 -0200
commit0e232a1db450d08a662be16279607730b049eb4d (patch)
treefe361b81cf1144db4222db4cc46f1ac21abd071d /manipulationhandler.cpp
parented0db5c8d8ed12fa02eab5e529db60d92d78d8b2 (diff)
Fixed issue #20; also removed some unused #include.
Diffstat (limited to 'manipulationhandler.cpp')
-rw-r--r--manipulationhandler.cpp18
1 files changed, 11 insertions, 7 deletions
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 <algorithm>
-#include <iostream>
-#include <numeric>
-
-#include <QDebug>
#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<arma::uword> 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;
}