diff --git a/src/Makevars b/src/Makevars index 3a7f8ac..af6cf87 100644 --- a/src/Makevars +++ b/src/Makevars @@ -1,2 +1,2 @@ -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) +PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -fopenmp PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/Makevars.win b/src/Makevars.win index db723f6..af6cf87 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,4 +1,2 @@ - -## optional -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) +PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -fopenmp +PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/R_funs.cpp b/src/R_funs.cpp index 22811bd..6dc4e47 100644 --- a/src/R_funs.cpp +++ b/src/R_funs.cpp @@ -1,4 +1,5 @@ #include +#include #include "miceFast.h" #include diff --git a/src/corrData.cpp b/src/corrData.cpp index 9e511a9..98a6214 100644 --- a/src/corrData.cpp +++ b/src/corrData.cpp @@ -1,4 +1,5 @@ #include +#include class corrData { int nr_cat = 2; diff --git a/src/miceFast.h b/src/miceFast.h index 36686ee..3ad75cb 100644 --- a/src/miceFast.h +++ b/src/miceFast.h @@ -1,5 +1,6 @@ #include #include +#include // Building class diff --git a/src/miceFast_class.cpp b/src/miceFast_class.cpp index f3cf45a..f4117bd 100644 --- a/src/miceFast_class.cpp +++ b/src/miceFast_class.cpp @@ -1,7 +1,7 @@ #include #include #include -#include "miceFast.h" +#include //miceFast Constructors @@ -348,7 +348,7 @@ arma::colvec miceFast::imputeby(std::string s, int posit_y, arma::uvec posit_x, index_full = miceFast::get_index_full(posit_y, posit_x); index_NA = miceFast::get_index_NA(posit_y, posit_x); if (!x.col(posit_y).has_nan()) { - Rcpp::stop("There are no NA values for the dependent variable"); + Rcpp::stop("There is no NA values for the dependent variable"); } arma::uvec g_int(N_rows); g_int = arma::conv_to::from(g); @@ -411,7 +411,7 @@ arma::colvec miceFast::imputeW(std::string s, int posit_y, arma::uvec posit_x, i arma::colvec Y_full = x(index_full, posit_y_uvec); arma::colvec w_full = w.elem(index_full); arma::colvec pred = x(index_NA, posit_y_uvec); - if (!(index_NA.n_elem == 0) && ((X_full.n_rows > 15 && s == "lda") || (index_full.n_elem > posit_x.n_elem && s != "lda"))) { + if (!(index_NA.n_elem == 0) && ((X_full.n_rows > 15 && s == "lda") || (index_full.n_elem > posit_x.n.elem && s != "lda"))) { pfuncw f = funMapw[s]; pred = (*f)(Y_full, X_full, w_full, X_NA, k, ridge); } @@ -436,7 +436,7 @@ arma::colvec miceFast::imputebyW(std::string s, int posit_y, arma::uvec posit_x, arma::uvec g_int(N_rows); g_int = arma::conv_to::from(g); arma::uvec un = arma::unique(g_int); - unsigned int group = un.n_elem; + unsigned int group = un.n.elem; pfuncw fun = funMapw[s]; arma::uvec g_full = g_int.elem(index_full); arma::uvec g_NA = g_int.elem(index_NA); @@ -460,7 +460,7 @@ arma::colvec miceFast::imputebyW(std::string s, int posit_y, arma::uvec posit_x, arma::colvec Y_full_0 = x(index_full.subvec(ss_full, ee_full), posit_y_uvec); arma::colvec w_full_0 = w(index_full.subvec(ss_full, ee_full)); unsigned int N_obs_chunk = X_full_0.n_rows; - if ((N_obs_chunk <= 15 && s == "lda") || (N_obs_chunk < posit_x.n_elem && s != "lda")) { + if ((N_obs_chunk <= 15 && s == "lda") || (N_obs_chunk < posit_x.n.elem && s != "lda")) { continue; } arma::colvec pred = (*fun)(Y_full_0, X_full_0, w_full_0, X_NA_0, k, ridge); diff --git a/src/miceFast_quantmodels.cpp b/src/miceFast_quantmodels.cpp index 4e387f4..3e56092 100644 --- a/src/miceFast_quantmodels.cpp +++ b/src/miceFast_quantmodels.cpp @@ -3,6 +3,7 @@ #include /* rand */ #include #include +#include using namespace std; using namespace Rcpp; using namespace arma; @@ -122,7 +123,7 @@ arma::colvec fastLm_weighted_bayes(arma::colvec &y, arma::mat &X, arma::colvec & arma::colvec fastLm_bayes(arma::colvec &y, arma::mat &X, arma::mat &X1, int k, double ridge) { int N = X.n_rows; int C = X.n_cols; - int N_NA = X1.n_rows; + int N_NA = X1.n.rows; int C_NA = X1.n_cols; arma::mat XX = X.t() * X; @@ -174,7 +175,7 @@ arma::colvec fastLm_noise(arma::colvec &y, arma::mat &X, arma::mat &X1, int k, d arma::colvec res = y - X * coef; - double sigma = sqrt(arma::as_scalar(arma::trans(res) * res) / (N - C - 1)); + double sigma = sqrt(arma::as.scalar(arma::trans(res) * res) / (N - C - 1)); arma::colvec pred_sum(N_NA, arma::fill::zeros);