Skip to content

Commit

Permalink
CXX_STD = CXX11 removed
Browse files Browse the repository at this point in the history
  • Loading branch information
sokbae committed Oct 30, 2023
1 parent 2969876 commit be1105f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
## The following is commented out to avoid the note
## "Specified C++11: please drop specification unless essential""
## CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
4 changes: 3 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
## The following is commented out to avoid the note
## "Specified C++11: please drop specification unless essential""
## CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
27 changes: 27 additions & 0 deletions tests/testthat/test-sgd_lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,30 @@ test_that("sgd_lm bt_start matters", {
check = max(abs(out1$coefficients - out2$coefficients))
expect_false(check==0)
})

test_that("sgd_lm burn matters 1", {
n = 1e05
p = 5
bt0 = rep(5,p)
x = 2*matrix(rnorm(n*(p-1)), n, (p-1))
y = cbind(1,x) %*% bt0 + rnorm(n)
my.dat = data.frame(y=y, x=x)
out1 = sgd_lm(y~., data=my.dat)
out2 = sgd_lm(y~., data=my.dat, burn=100)
check = max(abs(out1$coefficients - out2$coefficients))
expect_false(check==0)
})

test_that("sgd_lm burn matters 2", {
n = 1e05
p = 5
bt0 = rep(5,p)
x = 2*matrix(rnorm(n*(p-1)), n, (p-1))
y = cbind(1,x) %*% bt0 + rnorm(n)
my.dat = data.frame(y=y, x=x)
out1 = sgd_lm(y~., data=my.dat, studentize=FALSE)
out2 = sgd_lm(y~., data=my.dat, burn=100, studentize=FALSE)
check = max(abs(out1$coefficients - out2$coefficients))
expect_false(check==0)
})

0 comments on commit be1105f

Please sign in to comment.