aboutsummaryrefslogtreecommitdiff
path: root/lamp.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-09 21:36:34 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-09 21:36:34 -0200
commit5c26dd04dd171112d14bfb24db96cf286566e19b (patch)
tree62a2dd9370a54968bf543344153ef69a85561840 /lamp.cpp
parent886bdd0fa43a2fcdeca306648b643b623af99f88 (diff)
Slightly reworked rewinding; added values rewinding.
Needs a solution to the problem of which values must be displayed and/or interpolated. Currently, whenever the user rewinds, the current error measure is displayed, regardless of what was being displayed before. This will probably be trivial to solve once we have a nice way of changing the current measure. * Also changed all OpenMP-powered for loops to use signed integers, requirements of OMP2.x (which is what MSVC supports currently) * The above change comes with a new header for utility functions
Diffstat (limited to 'lamp.cpp')
-rw-r--r--lamp.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lamp.cpp b/lamp.cpp
index 293ce30..77bbac4 100644
--- a/lamp.cpp
+++ b/lamp.cpp
@@ -2,6 +2,8 @@
#include <algorithm>
+#include "utils.h"
+
static const double EPSILON = 1e-3;
arma::mat mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::mat &Ys)
@@ -13,11 +15,12 @@ arma::mat mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const ar
void mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::mat &Ys, arma::mat &Y)
{
+ int n = uintToInt<arma::uword, int>(X.n_rows);
const arma::mat &Xs = X.rows(sampleIndices);
arma::uword sampleSize = sampleIndices.n_elem;
- #pragma omp parallel for shared(X, Xs, Ys, Y)
- for (arma::uword i = 0; i < X.n_rows; i++) {
+ #pragma omp parallel for shared(X, Xs, Ys, Y, n)
+ for (int i = 0; i < n; i++) {
const arma::rowvec &point = X.row(i);
// calculate alphas