diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-02-09 21:36:34 -0200 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-02-09 21:36:34 -0200 |
commit | 5c26dd04dd171112d14bfb24db96cf286566e19b (patch) | |
tree | 62a2dd9370a54968bf543344153ef69a85561840 /dist.cpp | |
parent | 886bdd0fa43a2fcdeca306648b643b623af99f88 (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 'dist.cpp')
-rw-r--r-- | dist.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,7 @@ #include "mp.h" +#include "utils.h" + double mp::euclidean(const arma::rowvec &x1, const arma::rowvec &x2) { return arma::norm(x1 - x2, 2); @@ -7,11 +9,11 @@ double mp::euclidean(const arma::rowvec &x1, const arma::rowvec &x2) arma::mat mp::dist(const arma::mat &X, mp::DistFunc dfunc) { - arma::uword n = X.n_rows; + int n = uintToInt<arma::uword, int>(X.n_rows); arma::mat D(n, n, arma::fill::zeros); - #pragma omp parallel for shared(X, D) - for (arma::uword i = 0; i < n; i++) { + #pragma omp parallel for shared(X, D, n) + for (int i = 0; i < n; i++) { for (arma::uword j = 0; j < i; j++) { D(i, j) = dfunc(X.row(i), X.row(j)); D(j, i) = D(i, j); |