Skip to content

cap probabilities with a scalar in kernel_wPB_fast - #1

Open
kevinushey wants to merge 1 commit into
DISOhda:masterfrom
kevinushey:bugfix/rcpp-sugar-lengths
Open

kevinushey wants to merge 1 commit into
DISOhda:masterfrom
kevinushey:bugfix/rcpp-sugar-lengths

Conversation

@kevinushey

Copy link
Copy Markdown

Background

The next Rcpp release (see RcppCore/Rcpp#1513) checks that the operands of a sugar expression, and a vector assigned into a matrix row, column or Range subset, have matching lengths. Previously a longer operand was silently truncated to the length of the left-hand side or target. With that check, FDX fails its CRAN checks with:

Error: sugar operands have different lengths (7 and 8)

In kernel_wPB_fast(), probs has numWeights[i] elements (which is less than numTests for i > 0), but it is capped with pmin(probs, NumericVector(numTests, 1.0)), a vector of length numTests. Old Rcpp read only the first numWeights[i] ones, so results were correct.

Change

Cap with the scalar form pmin(probs, 1.0), which does the same thing for any length.

Testing

R CMD check on the patched package passes against both the current Rcpp branch and released Rcpp 1.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant