Skip to content

Commit

Permalink
Fix the warning message in R Mac's cran test (GeomScale#285)
Browse files Browse the repository at this point in the history
* copy and replace lp_rlp.h

* remove re-initialization of eta

* update ubuntu version from 18 to 20 in R cran tests

* minor improvements (explanatory comments)
  • Loading branch information
TolisChal committed Jul 7, 2024
1 parent ac68063 commit 7659c94
Show file tree
Hide file tree
Showing 4 changed files with 2,466 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
config:
- {os: ubuntu-latest, r: 'devel'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-18.04, r: 'devel'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-20.04, r: 'devel'}
- {os: ubuntu-20.04, r: 'release'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand Down
6 changes: 2 additions & 4 deletions R-proj/src/sample_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Rcpp::NumericMatrix sample_points(Rcpp::Nullable<Rcpp::Reference> P,
random_walks walk;
ode_solvers solver; // Used only for logconcave sampling

NT eta;
NT eta = 1;
std::list<Point> randPoints;
std::pair<Point, NT> InnerBall;
Point mode(dim);
Expand Down Expand Up @@ -410,7 +410,7 @@ Rcpp::NumericMatrix sample_points(Rcpp::Nullable<Rcpp::Reference> P,
Rcpp::Function negative_logprob = Rcpp::as<Rcpp::List>(distribution)["negative_logprob"];
Rcpp::Function negative_logprob_gradient = Rcpp::as<Rcpp::List>(distribution)["negative_logprob_gradient"];

NT L_, m, eta;
NT L_, m;

if (Rcpp::as<Rcpp::List>(distribution).containsElementNamed("L_")) {
L_ = Rcpp::as<NT>(Rcpp::as<Rcpp::List>(distribution)["L_"]);
Expand Down Expand Up @@ -459,8 +459,6 @@ Rcpp::NumericMatrix sample_points(Rcpp::Nullable<Rcpp::Reference> P,

functor_defined = false;

NT eta;

if (Rcpp::as<Rcpp::List>(random_walk).containsElementNamed("step_size")) {
eta = NT(Rcpp::as<NT>(Rcpp::as<Rcpp::List>(random_walk)["step_size"]));
if (eta <= NT(0)) {
Expand Down
2 changes: 2 additions & 0 deletions cran_gen/genCRANpkg.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ dir_lp = paste0(path,"/lpSolveAPI/inst/include")
h_files = dir(dir_lp, "*.h", ignore.case = TRUE, all.files = TRUE)
lp_dist = paste0(path,"/external/LPsolve_src/include")
file.copy(file.path(dir_lp, h_files), lp_dist, recursive=TRUE, overwrite=TRUE)
# replace the lpsolve header file that issues a warning in mac's cran test
file.copy(paste0(path,"/external/cmake-files/lpsolve_modified_header_files/lp_rlp.h"), lp_dist, recursive=TRUE, overwrite=TRUE)
dir_lp = paste0(path,"/lpSolve/src")
h_files = dir(dir_lp, "*.h", ignore.case = TRUE, all.files = TRUE)
lp_dist = paste0(path,"/external/LPsolve_src/run_headers")
Expand Down
Loading

0 comments on commit 7659c94

Please sign in to comment.