Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forder and rxInv string fixes as requested by CRAN #644

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Other changes

- `rxUi` compression now defaults to fast compression
- Fixes String literal formatting issues as identified by CRAN (#643)

# rxode2 2.1.0

Expand Down
10 changes: 5 additions & 5 deletions src/forder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@

extern "C" SEXP getRxThreads_R(SEXP verbose) {
if (!isLogical(verbose) || LENGTH(verbose)!=1 || INTEGER(verbose)[0]==NA_LOGICAL)
Rf_errorcall(R_NilValue, _("'verbose' must be TRUE or FALSE"));
Rf_errorcall(R_NilValue, "%s", _("'verbose' must be TRUE or FALSE"));

Check warning on line 103 in src/forder.cpp

View check run for this annotation

Codecov / codecov/patch

src/forder.cpp#L103

Added line #L103 was not covered by tests
if (LOGICAL(verbose)[0]) {
#ifndef _OPENMP
Rprintf(_("This installation of data.table has not been compiled with OpenMP support.\n"));
Rprintf("%s", _("This installation of data.table has not been compiled with OpenMP support.\n"));
#endif
// this output is captured, paste0(collapse="; ")'d, and placed at the end of test.data.table() for display in the last 13 lines of CRAN check logs
// it is also printed at the start of test.data.table() so that we can trace any Killed events on CRAN before the end is reached
Expand All @@ -125,7 +125,7 @@
extern "C" SEXP setRxthreads(SEXP threads, SEXP percent, SEXP throttle) {
if (length(throttle)) {
if (!isInteger(throttle) || LENGTH(throttle)!=1 || INTEGER(throttle)[0]<1)
error(_("'throttle' must be a single number, non-NA, and >=1"));
error("%s", _("'throttle' must be a single number, non-NA, and >=1"));

Check warning on line 128 in src/forder.cpp

View check run for this annotation

Codecov / codecov/patch

src/forder.cpp#L128

Added line #L128 was not covered by tests
rxThrottle = INTEGER(throttle)[0];
}
int old = rxThreads;
Expand All @@ -139,11 +139,11 @@
} else if (length(threads)) {
int n=0;
if (length(threads)!=1 || !isInteger(threads) || (n=INTEGER(threads)[0]) < 0) { // <0 catches NA too since NA is negative (INT_MIN)
Rf_errorcall(R_NilValue, _("threads= must be either NULL or a single number >= 0 See ?setRxthreads"));
Rf_errorcall(R_NilValue, "%s", _("threads= must be either NULL or a single number >= 0 See ?setRxthreads"));

Check warning on line 142 in src/forder.cpp

View check run for this annotation

Codecov / codecov/patch

src/forder.cpp#L142

Added line #L142 was not covered by tests
}
int num_procs = imax(omp_get_num_procs(), 1); // max just in case omp_get_num_procs() returns <= 0 (perhaps error, or unsupported)
if (!isLogical(percent) || length(percent)!=1 || LOGICAL(percent)[0]==NA_LOGICAL) {
Rf_errorcall(R_NilValue, _("internal error: percent= must be TRUE or FALSE at C level")); // # nocov
Rf_errorcall(R_NilValue, "%s", _("internal error: percent= must be TRUE or FALSE at C level")); // # nocov
}
if (LOGICAL(percent)[0]) {
if (n<2 || n>100) error(_("internal error: threads==%d should be between 2 and 100 (percent=TRUE at C level)"), n); // # nocov
Expand Down
24 changes: 12 additions & 12 deletions src/rxInv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
using namespace arma;
extern "C" SEXP _rxCholInv(SEXP dms, SEXP theta, SEXP tn);

//' Invert matrix using RcppArmadillo.
//' Invert matrix using RcppArmadillo.
//'
//' @param matrix matrix to be inverted.
//'
//'
//' @return inverse or pseudo inverse of matrix.
//'
//'
//' @export
// [[Rcpp::export]]
NumericVector rxInv(SEXP matrix){
Expand All @@ -33,7 +33,7 @@
success = inv(imat, smatrix);
if (!success){
imat = pinv(smatrix);
Rprintf(_("matrix seems singular; Using pseudo-inverse\n"));
Rprintf("%s", _("matrix seems singular; Using pseudo-inverse\n"));

Check warning on line 36 in src/rxInv.cpp

View check run for this annotation

Codecov / codecov/patch

src/rxInv.cpp#L36

Added line #L36 was not covered by tests
}
NumericVector ret;
ret = wrap(imat);
Expand Down Expand Up @@ -71,15 +71,15 @@
//' [rxSymInvCholCreate()] with the default arguments and return a
//' reactive s3 object. Otherwise, use the inversion object to
//' calculate the requested derivative/inverse.
//'
//'
//' @param theta Thetas to be used for calculation. If missing (`NULL`), a
//' special s3 class is created and returned to access `Omega^1`
//' objects as needed and cache them based on the theta that is
//' used.
//'
//'
//' @param type The type of object. Currently the following types are
//' supported:
//'
//'
//' * `cholOmegaInv` gives the
//' Cholesky decomposition of the Omega Inverse matrix.
//' * `omegaInv` gives the Omega Inverse matrix.
Expand All @@ -88,18 +88,18 @@
//' * `d(D)` gives the `d(diagonal(Omega^-1))` with respect to
//' the theta parameter specified in the `thetaNumber`
//' parameter
//'
//'
//' @param thetaNumber For types `d(omegaInv)` and `d(D)`,
//' the theta number that the derivative is taken against. This
//' must be positive from 1 to the number of thetas defining the
//' Omega matrix.
//'
//'
//' @return Matrix based on parameters or environment with all the
//' matrixes calculated in variables `omega`, `omegaInv`, `dOmega`,
//' `dOmegaInv`.
//'
//'
//' @author Matthew L. Fidler
//'
//'
//' @export
// [[Rcpp::export]]
RObject rxSymInvChol(RObject invObjOrMatrix, Nullable<NumericVector> theta = R_NilValue, std::string type = "cholOmegaInv", int thetaNumber = 0){
Expand Down Expand Up @@ -200,7 +200,7 @@
} else if (what == "chol.omega1"){
rxSymInvCholEnvCalculate(obj, "chol.omegaInv", R_NilValue);
arma::mat ret = rxToCholOmega(as<arma::mat>(e["chol.omegaInv"]));
e["chol.omega1"] = ret;
e["chol.omega1"] = ret;
} else if (what == "omega"){
rxSymInvCholEnvCalculate(obj, "chol.omega1", R_NilValue);
arma::mat U1 = as<mat>(e["chol.omega1"]);
Expand Down
4 changes: 2 additions & 2 deletions src/rxode2_df.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ extern "C" SEXP rxode2_df(int doDose0, int doTBS) {
if (op->badSolve){
if (op->naTime){
rxSolveFreeC();
Rf_errorcall(R_NilValue, _("'alag(.)'/'rate(.)'/'dur(.)' cannot depend on the state values"));
Rf_errorcall(R_NilValue, "%s", _("'alag(.)'/'rate(.)'/'dur(.)' cannot depend on the state values"));
}
if (nidCols == 0){
for (int solveid = 0; solveid < rx->nsub * rx->nsim; solveid++){
Expand All @@ -225,7 +225,7 @@ extern "C" SEXP rxode2_df(int doDose0, int doTBS) {
}
}
rxSolveFreeC();
Rf_errorcall(R_NilValue, _("could not solve the system"));
Rf_errorcall(R_NilValue, "%s", _("could not solve the system"));
} else {
warning(_("some ID(s) could not solve the ODEs correctly; These values are replaced with 'NA'"));
}
Expand Down
Loading