Repository navigation
fix off-by-one range in make_BM - #23
Open
kevinushey wants to merge 1 commit into
Open
kevinushey wants to merge 1 commit into
kevinushey wants to merge 1 commit into
Conversation
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Rangesubset, have matching lengths. Previously a longer operand was silently truncated to the length of the left-hand side or target. With that check, greeks fails its CRAN checks with:In
make_BM(),Range(s, s + paths)is inclusive on both ends, so it coverspaths + 1elements, while the columnW(_, col - 1)it is added to haspathselements. Old Rcpp used only the firstpathselements, so the Brownian paths were correct; the extra element was never read. On the last column the extra index is also one past the end ofv.Change
Use
Range(s, s + paths - 1)so both operands have lengthpaths. Results are unchanged.Testing
R CMD checkon the patched package passes against both the current Rcpp branch and released Rcpp 1.1.2. The package tests compare against reference values and pass unchanged.