-
Notifications
You must be signed in to change notification settings - Fork 41
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
ndarray improvements #275
ndarray improvements #275
Conversation
You'll probably have to test for equality of each individual element, just like the other tests in the same source file. |
Oh is that why all the other tests did that. Is there any discussion about implementing a |
I can't find any. My guess is that |
Well I'll open an issue for it. Surely the R API has a way to compare by value? Or if not we can just write comparison functions like I have done here for vectors/arrays |
Thanks, I think we need to write it by ourselves. |
Turns out I'm wrong, actually. We're using the extendr/extendr-api/src/robj/mod.rs Lines 956 to 967 in a06962c
And this function quite neatly compares all aspects of any Robj by value: I think my code was not working with this function only because the attribute lists were different (which I still don't understand). |
Oh, I didn't notice it, sorry. |
@andy-thomason @clauswilke @Ilia-Kosenkov |
I agree. |
I just pushed a refactor, it should be much cleaner now. Other than what is being discussed in the review, I'd appreciate review on:
|
@multimeric, |
I can answer this. We have recently devised some ground rules on how to handle the marshaling of
I am not really familiar with |
large for R, add another 3d test
Okay, I've changed this such that it will panic in this (rare) scenario. I could also change it to return an error, but then we would have to implement |
We're moving to |
If there's another branch I should target in order to use |
Therefore, I would suggest moving to |
No, development is happening in master. |
Okay. Do we have some kind of error scheme I should be following? Just strings? |
I think this is the one |
Okay. Do I just add new errors to that enum? Because the kind of errors I expect are like "axis too long", and whatever kind of error |
Maybe just use |
|
Done. |
LGTM, but I'd like to suggest to test one other edge case -- 'empty' arrays. As far as I can see, we have no such tests. PS: I was under the impression the CI will continue working after I approved it once, but it seems it requires manual triggering for now. EDIT01: to clarify, an empty EDIT02: |
I believe CI needs to be approved manually until somebody has made at least one accepted contribution to a repo: https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks It doesn't say so in the github docs, but I believe this is primarily to prevent cryptocurrency mining via github actions. |
Done. |
Only the MacOS test is failing but I don't think it's due to my PR? |
I'm re-running the tests. Not clear to me why OSX is failing. |
The OSX failure has persisted for a while now. Maybe @yutannihilation knows what's going on? |
CRAN sometimes incorrectly distributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Few suggestions:
- First, I'd recommend to update the
CHANGELOG.md
with a one-line entry mentioning the support ofTryFrom
for arrays. You not only implemented new features, but also bumped the version of an (optional) dependency, so I'd say it is worth writing down. - Second, if you feel like doing some
R
coding, it could be nice to have some array tests intests/extendrtests
. This package showcasesextendr
features (and also tests them), so having, say, a Rust function that accepts two matrices, multiplies them, and then returns the product back toR
would be nice. This is a topic for a separate PR and can be implemented by someone else.
No idea, but let's ignore.
|
Done. I also got some helpful comments from one of the
Sounds good, but yes I would rather leave this to another PR. |
@multimeric, |
Hooray! Thanks for the merge. I look forward to the next major release. |
Changes:
From<ArrayBase<S, D>> for Robj
ie conversion from any ndarray to an Robj, with testsOutstanding questions:
How can we actually compare R objects in Rust? My tests are failing I assume because the pointers are not the same, even though the string representation seems identicalWhy do the arrays created usingR!
not have any classes set when Ia.get_attrib(class_symbol())
?