Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Polkas committed Jan 16, 2025
1 parent e23bbf6 commit 2c855ca
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 2 additions & 4 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions src/R_funs.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <RcppArmadillo.h>
#include <omp.h>
#include "miceFast.h"
#include <math.h>

Expand Down
1 change: 1 addition & 0 deletions src/corrData.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <RcppArmadillo.h>
#include <omp.h>

class corrData {
int nr_cat = 2;
Expand Down
1 change: 1 addition & 0 deletions src/miceFast.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <RcppArmadillo.h>
#include <string>
#include <omp.h>

// Building class

Expand Down
10 changes: 5 additions & 5 deletions src/miceFast_class.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <RcppArmadillo.h>
#include <string>
#include <map>
#include "miceFast.h"
#include <omp.h>

//miceFast Constructors

Expand Down Expand Up @@ -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<arma::uvec>::from(g);
Expand Down Expand Up @@ -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);
}
Expand All @@ -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<arma::uvec>::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);
Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/miceFast_quantmodels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdlib.h> /* rand */
#include <algorithm>
#include <vector>
#include <omp.h>
using namespace std;
using namespace Rcpp;
using namespace arma;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 2c855ca

Please sign in to comment.