diff --git a/.Rbuildignore b/.Rbuildignore index 6d87dae1..094bb570 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -36,3 +36,5 @@ deprecated .covrignore src/Makevars$ src/Makevars.win$ +to_fix* +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 00000000..e91558cb --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 3.3.1 +Date: 2023-04-09 20:06:33 UTC +SHA: d88c531efa06933c1007cb785343f1382c95ee0d diff --git a/DESCRIPTION b/DESCRIPTION index 3f493895..14d493be 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: Cyclops Type: Package Title: Cyclic Coordinate Descent for Logistic, Poisson and Survival Analysis -Version: 3.3.0 +Version: 3.3.1 Authors@R: c( person("Marc A.", "Suchard", email = "msuchard@ucla.edu", role = c("aut","cre")), person("Martijn J.", "Schuemie", role = "aut"), @@ -51,4 +51,4 @@ Suggests: ggplot2, microbenchmark, cmprsk -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.3 diff --git a/NEWS.md b/NEWS.md index 3cf71839..4c72ca68 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ +Cyclops v3.3.1 +============== + +Changes: + +1. fix uninitialized value in detected in computeAsymptoticPrecisionMatrix(); value was priorType +2. fix memory leak caused by call to ::Rf_error() +3. fix line-endings on Makevar on windows + Cyclops v3.3.0 ============== diff --git a/cran-comments.md b/cran-comments.md index c4255b42..edfb58e1 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,16 +1,23 @@ -## Initial submission of patch update to package +## Resubmission after VALGRIND feedback from Brian Ripley -* fixed all WARNINGS, including generic-inconsistency, uninitialized values -* fixed NOTE about C++11 +* fixed VALGRIND uninitialized value (UB) issue; variable 'priorType' was uninitialized, + specifically in: + + ==2293460== Conditional jump or move depends on uninitialised value(s) + ==2293460== at 0x22CE4848: bsccs::CyclicCoordinateDescent::computeAsymptoticPrecisionMatrix() (packages/tests-vg/Cyclops/src/cyclops/CyclicCoordinateDescent.cpp:1335) + +* fixed VALGRIND memory leak issue; was caused by calls to '::Rf_error()' instead of + 'Rcpp::stop()' when handling some error edge-cases ## Test environments * local OS X install, R 4.1 +* r-devel-valgrind docker container * ubuntu 20.04 (via gh-actions: devel and release) * win-builder (devel and release) ## R CMD check results * There were no ERRORs or WARNINGs -* There is 1 occasional NOTE: +* There is 1 occasional NOTE (besides days since last submission): checking installed package size ... NOTE installed size is 22.5Mb sub-directories of 1Mb or more: @@ -23,4 +30,6 @@ availability of C++17 'if (constexpr ...)' should decrease library size substant ## Downstream dependencies * 'EvidenceSynthesis' - checked and works. +* 'EmpiricalCalibration' - checked and works. * 'IterativeHardThresholding' - checked and works. +* 'BrokenAdaptiveRidge' - checked and works. diff --git a/man/convertToCyclopsData.Rd b/man/convertToCyclopsData.Rd index 61a6bd75..391ec1ec 100644 --- a/man/convertToCyclopsData.Rd +++ b/man/convertToCyclopsData.Rd @@ -89,11 +89,11 @@ These columns are expected in the covariates object: } \section{Methods (by class)}{ \itemize{ -\item \code{data.frame}: Convert data from two \code{data.frame} +\item \code{convertToCyclopsData(data.frame)}: Convert data from two \code{data.frame} -\item \code{tbl_dbi}: Convert data from two \code{Andromeda} tables -}} +\item \code{convertToCyclopsData(tbl_dbi)}: Convert data from two \code{Andromeda} tables +}} \examples{ #Convert infert dataset to Cyclops format: covariates <- data.frame(stratumId = rep(infert$stratum, 2), diff --git a/src/RcppCyclopsInterface.cpp b/src/RcppCyclopsInterface.cpp index ae9b1914..ae8ff12e 100644 --- a/src/RcppCyclopsInterface.cpp +++ b/src/RcppCyclopsInterface.cpp @@ -622,8 +622,8 @@ void RcppCcdInterface::appendRList(Rcpp::List& list, const Rcpp::List& append) { } void RcppCcdInterface::handleError(const std::string& str) { -// Rcpp::stop(str); // TODO Want this to work - ::Rf_error(str.c_str()); + Rcpp::stop(str); + // ::Rf_error(str.c_str()); } bsccs::ConvergenceType RcppCcdInterface::parseConvergenceType(const std::string& convergenceName) { @@ -946,7 +946,7 @@ void RcppCcdInterface::initializeModelImpl( // } // singlePrior->setVariance(0, arguments.hyperprior); - JointPriorPtr prior; + JointPriorPtr prior = nullptr; // if (arguments.flatPrior.size() == 0) { // prior = bsccs::make_shared(singlePrior); // } else { diff --git a/src/RcppModelData.cpp b/src/RcppModelData.cpp index 7eb7796b..f585a6fe 100644 --- a/src/RcppModelData.cpp +++ b/src/RcppModelData.cpp @@ -675,7 +675,7 @@ List cyclopsReadFileData(const std::string& fileName, const std::string& modelTy //const std::vector& y = ptr->getYVectorRef(); double total = 0.0; //std::accumulate(y.begin(), y.end(), 0.0); - // delete reader; // TODO Test + delete reader; // TODO Use smart_ptr double time = timer(); List list = List::create( diff --git a/src/cyclops/CyclicCoordinateDescent.cpp b/src/cyclops/CyclicCoordinateDescent.cpp index fbb03df2..6e54b9f2 100644 --- a/src/cyclops/CyclicCoordinateDescent.cpp +++ b/src/cyclops/CyclicCoordinateDescent.cpp @@ -54,6 +54,8 @@ CyclicCoordinateDescent::CyclicCoordinateDescent( noiseLevel = NOISY; initialBound = 2.0; + priorType = priors::NONE; + init(hXI.getHasOffsetCovariate()); } @@ -89,6 +91,8 @@ CyclicCoordinateDescent::CyclicCoordinateDescent(const CyclicCoordinateDescent& noiseLevel = copy.noiseLevel; initialBound = copy.initialBound; + priorType = copy.priorType; + init(hXI.getHasOffsetCovariate()); if (copy.hWeights.size() > 0) { diff --git a/src/cyclops/engine/ModelSpecifics.hpp b/src/cyclops/engine/ModelSpecifics.hpp index 84f9eed3..e08e7da1 100644 --- a/src/cyclops/engine/ModelSpecifics.hpp +++ b/src/cyclops/engine/ModelSpecifics.hpp @@ -1124,7 +1124,7 @@ void ModelSpecifics::computeGradientAndHessianImpl(int index // gradient = result.real(); // hessian = result.imag(); - using RealTypePair = std::pair; + // using RealTypePair = std::pair; IteratorType it(hX, index); const int end = it.size() - 1; @@ -1266,7 +1266,7 @@ void ModelSpecifics::computeThirdDerivativeImpl(int index, d #endif RealType third = static_cast(0); - RealType hessian = static_cast(0); + // RealType hessian = static_cast(0); if (BaseModel::cumulativeGradientAndHessian) { // Compile-time switch diff --git a/tools/configure.R b/tools/configure.R index d9853786..08ab5033 100644 --- a/tools/configure.R +++ b/tools/configure.R @@ -19,5 +19,8 @@ if (getRversion() < "4.1") { } } -cat(txt, file = makevars_out, sep = "\n") -cat(txt_win, file = makevars_win_out, sep = "\n") +if (.Platform$OS.type == "unix") { + cat(txt, file = makevars_out, sep = "\n") +} else { + cat(txt_win, file = makevars_win_out, sep = "\n") +}