Skip to content

Commit

Permalink
merge from main and adaption makevars to M1 processors
Browse files Browse the repository at this point in the history
Merge branch 'main' into dev
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
  • Loading branch information
LukaszChrostowski committed Mar 21, 2024
2 parents df2b295 + 8824584 commit a2aa0da
Show file tree
Hide file tree
Showing 6 changed files with 1,540 additions and 22,485 deletions.
3,017 changes: 1,508 additions & 1,509 deletions inst/tinytest/test-2-ipw-totals.R

Large diffs are not rendered by default.

20,947 changes: 0 additions & 20,947 deletions inst/tinytest/test_data.csv

This file was deleted.

43 changes: 23 additions & 20 deletions inst/tinytest/test_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ expect_silent(
residuals(test1a, "pearsonSTD")
)

expect_silent(
cooks.distance(test1a)
)

expect_silent(
hatvalues(test1a)
)
# expect_silent(
# cooks.distance(test1a)
# )
#
# expect_silent(
# hatvalues(test1a)
# )

expect_silent(
logLik(test1a)
Expand Down Expand Up @@ -111,13 +111,14 @@ expect_silent(
residuals(test2a, "pearsonSTD")
)

expect_silent(
cooks.distance(test2a)
)

expect_silent(
hatvalues(test2a)
)
if (isTRUE(tolower(Sys.getenv("TEST_NONPROBSVY_MULTICORE_DEVELOPER")) == "true")) {
expect_silent(
cooks.distance(test2a)
)
expect_silent(
hatvalues(test2a)
)
}

expect_silent(
logLik(test2a)
Expand Down Expand Up @@ -180,13 +181,15 @@ expect_silent(
residuals(test3a, "pearsonSTD")
)

expect_silent(
cooks.distance(test3a)
)
if (isTRUE(tolower(Sys.getenv("TEST_NONPROBSVY_MULTICORE_DEVELOPER")) == "true")) {
expect_silent(
cooks.distance(test3a)
)

expect_silent(
hatvalues(test3a)
)
expect_silent(
hatvalues(test3a)
)
}

expect_silent(
logLik(test3a)
Expand Down
8 changes: 4 additions & 4 deletions inst/tinytest/test_nonprobsvy_main.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Definition of data
#library(survey)
# library(dplyr)
data <- read.csv("test_data.csv")
# data <- read.csv("test_data.csv")
# data |>
# mutate(zawod_kod2 = factor(zawod_kod2),
# jedna_zmiana=as.numeric(jedna_zmiana))
data$zawod_kod2 <- as.factor(data$zawod_kod2)
data$jedna_zmiana <- as.numeric(data$jedna_zmiana)
# data$zawod_kod2 <- as.factor(data$zawod_kod2)
# data$jedna_zmiana <- as.numeric(data$jedna_zmiana)

# ## probability sample
# data |>
Expand Down Expand Up @@ -82,7 +82,7 @@ expect_true(
pop_totals <- c(`(Intercept)` = 294294, klasa_prM = 128940, klasa_prS = 71230)
test_dr_2 <- nonprob(selection = ~ klasa_pr,
outcome = jedna_zmiana ~ klasa_pr,
data = subset(data, !is.na(id_cbop)),
data = cbop_df,
pop_totals = pop_totals,
control_inference = controlInf(var_method = "analytic")) # TODO warning to connected to algorithm convergence

Expand Down
6 changes: 3 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## _In general_ we should no longer need to set a standard as any recent R
## installation will do the right thing. Should you need it, uncomment it and
## set the appropriate value, possibly CXX17.
#CXX_STD = CXX11
# CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
# PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
# PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
4 changes: 2 additions & 2 deletions src/nonprobCV_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ arma::vec q_lambda_cpp(const arma::vec& par,
}
}
} else if (penalty == "lasso") {
for (int i = 0; i < par.size(); i++) { // convert par.size() to int
for (std::size_t i = 0; i < par.size(); i++) { // int i = 0; i < par.size(); i++
if (par[i] < 0) {
penaltyd[i] = - lambda;
} else if (par[i] > 0) {
Expand All @@ -350,7 +350,7 @@ arma::vec q_lambda_cpp(const arma::vec& par,
}
// penaltyd = lambda * arma::sign(par);
} else if (penalty == "MCP") {
for (int i = 0; i < par.size(); i++) { // convert par.size() to int
for (std::size_t i = 0; i < par.size(); i++) { // int i = 0; i < par.size(); i++
if (std::abs(par[i]) <= a*lambda) {
if (par[i] < 0) {
penaltyd[i] = - (lambda - std::abs(par[i]) / a);
Expand Down

0 comments on commit a2aa0da

Please sign in to comment.