-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Subsetter indexing uses int, breaks for matrices with > MAXINT elements #919
Comments
Interesting caveat here. Even if the code were fixed to use R_xlen_t internally, using an IntegerVector as the subsetting array type will ultimately not be able to address the deeper elements of a "too big" matrix, as under the covers the get_indices specialization for IntegerVector casts it to INTEGER, which is of course an int *. String and bool indexing is unaffected. Real indexing currently is broken (creates a temp IntegerVector -- same problem). But that's fixable. It should be possible to modify the specialization for NumericVector to do the right thing. Numerics can represent up to 2^53 in R_xlen_t values when cast to them, which is fine. Would it be better to throw an exception with a helpful warning ("use NumericVector for objects of this size") in get_indices if size() > 2^31 and it was called with an IntegerVector? |
Okay, I have a fix that seems to work and handles the issues above. Need to do some reading on how to submit pull request and run unit tests first. |
We're here to help, also on the small stuff. Try creating a local source tarball ( I use helper scripts |
Now taken care of in #920. Thanks for that, and the report ;-) |
Various parts of Subsetter use int for indexing instead of R_xlen_t, causing it to break for matrices with > MAXINT elements (x86_64 arch).
Example (subset.cc) below:
Compiled via:
Results from running a.out:
Will try to put together a fix to revamp Subsetter to use the R_xlen_t internally.
The text was updated successfully, but these errors were encountered: