From 5c26dd04dd171112d14bfb24db96cf286566e19b Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 9 Feb 2016 21:36:34 -0200 Subject: 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 --- lamp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lamp.cpp') diff --git a/lamp.cpp b/lamp.cpp index 293ce30..77bbac4 100644 --- a/lamp.cpp +++ b/lamp.cpp @@ -2,6 +2,8 @@ #include +#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(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 -- cgit v1.2.3