aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--forceScheme.cpp1
-rw-r--r--lamp.cpp3
-rw-r--r--main.cpp12
3 files changed, 7 insertions, 9 deletions
diff --git a/forceScheme.cpp b/forceScheme.cpp
index 0dc7e34..90bf6c0 100644
--- a/forceScheme.cpp
+++ b/forceScheme.cpp
@@ -1,7 +1,6 @@
#include "mp.h"
#include <algorithm>
-#include <vector>
static const double EPSILON = 1e-3;
diff --git a/lamp.cpp b/lamp.cpp
index b7a1027..7d36877 100644
--- a/lamp.cpp
+++ b/lamp.cpp
@@ -16,7 +16,7 @@ void mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::m
const arma::mat &Xs = X.rows(sampleIndices);
arma::uword sampleSize = sampleIndices.n_elem;
- #pragma omp parallel for shared(X, Xs, sampleIndices, Ys, Y)
+ #pragma omp parallel for shared(X, Xs, Ys, Y)
for (arma::uword i = 0; i < X.n_rows; i++) {
const arma::rowvec &point = X.row(i);
@@ -52,7 +52,6 @@ void mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::m
arma::svd(U, s, V, At * B);
arma::mat M = U.cols(0, 1) * V.t();
- // the projection of point i
Y(i, arma::span(0, 1)) = (point - Xtil) * M + Ytil;
}
}
diff --git a/main.cpp b/main.cpp
index 5da297f..84579b5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
arma::uword n = dataset.n_rows;
arma::uword subsampleSize = (arma::uword) sqrt(n) * 3;
arma::uvec sampleIndices = arma::randi<arma::uvec>(subsampleSize, arma::distr_param(0, n-1));
- arma::mat Ys = arma::randn(subsampleSize, 2);
+ arma::mat Ys(subsampleSize, 2, arma::fill::randn);
Ys = mp::forceScheme(mp::dist(X.rows(sampleIndices)), Ys);
arma::mat subsampleData(subsampleSize, 3);
subsampleData.cols(0, 1) = Ys;
@@ -45,12 +45,12 @@ int main(int argc, char **argv)
Scatterplot *plot = engine.rootObjects()[0]->findChild<Scatterplot *>("plot");
// connect both plots through interaction handler
- std::unique_ptr<InteractionHandler> interactionHandler(new InteractionHandler(X, labels, sampleIndices));
+ InteractionHandler interactionHandler(X, labels, sampleIndices);
QObject::connect(subsamplePlot, SIGNAL(dataChanged(const arma::mat &)),
- interactionHandler.get(), SLOT(setSubsample(const arma::mat &)));
- QObject::connect(interactionHandler.get(), SIGNAL(subsampleChanged(const arma::mat &)),
- plot, SLOT(setData(const arma::mat &)));
- interactionHandler.get()->setSubsample(Ys);
+ &interactionHandler, SLOT(setSubsample(const arma::mat &)));
+ QObject::connect(&interactionHandler, SIGNAL(subsampleChanged(const arma::mat &)),
+ plot, SLOT(setData(const arma::mat &)));
+ interactionHandler.setSubsample(Ys);
return app.exec();
}