From edec66c5fc8122d2faa102b4f42dbc11674352c7 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Fri, 4 Mar 2016 23:14:07 -0300 Subject: main(): fixed code for init'ing CP projection. Minor code improvements in forceScheme() and dist(). --- dist.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dist.cpp') diff --git a/dist.cpp b/dist.cpp index f307564..cd85b6f 100644 --- a/dist.cpp +++ b/dist.cpp @@ -10,11 +10,12 @@ double mp::euclidean(const arma::rowvec &x1, const arma::rowvec &x2) arma::mat mp::dist(const arma::mat &X, mp::DistFunc dfunc) { int n = uintToInt(X.n_rows); - arma::mat D(n, n, arma::fill::zeros); + arma::mat D(n, n); #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, i) = 0; + for (int j = 0; j < i; j++) { D(i, j) = dfunc(X.row(i), X.row(j)); D(j, i) = D(i, j); } -- cgit v1.2.3