[RF][PyROOT] Fix RooDataSet.from_numpy() for contiguous input arrays#13609
Conversation
|
Starting build on |
|
Build failed on ROOT-ubuntu2204/nortcxxmod. Failing tests: |
|
Build failed on ROOT-ubuntu2004/python3. Failing tests: |
|
Build failed on mac11/noimt. Failing tests: |
vepadulano
left a comment
There was a problem hiding this comment.
Looks good overall, thanks! Left a couple of minor comments
| void_p = ctypes.cast(beg, ctypes.c_voidp).value + 4 * len(arr) | ||
| end = ctypes.cast(void_p, ctypes.POINTER(ctypes.c_int)) | ||
| ROOT.std.copy(beg, end, vec.begin()) | ||
| # Make sure that the array is contiguous to we can std::copy() it. |
There was a problem hiding this comment.
| # Make sure that the array is contiguous to we can std::copy() it. | |
| # Make sure that the array is contiguous so we can std::copy() it. |
|
|
||
| vec.resize(len(arr)) | ||
|
|
||
| beg = arr.ctypes.data_as(ctypes.POINTER(c_type)) |
There was a problem hiding this comment.
Possibly add comment here
| beg = arr.ctypes.data_as(ctypes.POINTER(c_type)) | |
| # The next part works because arr is guaranteed to be C-contiguous | |
| beg = arr.ctypes.data_as(ctypes.POINTER(c_type)) |
|
|
||
| def test_non_contiguous_arrays(self): | ||
| """Test whether the import also works with non-continguous arrays. | ||
| Covers GitHub issue #1360. |
There was a problem hiding this comment.
| Covers GitHub issue #1360. | |
| Covers GitHub issue #13605. |
e8d262a to
bff178d
Compare
|
Starting build on |
|
Thanks a lot for your review, @vepadulano! I have addressed the comments. |
|
Build failed on ROOT-ubuntu2204/nortcxxmod. |
|
Build failed on ROOT-performance-centos8-multicore/soversion. Failing tests: |
|
Build failed on mac11/noimt. Failing tests: |
|
Build failed on ROOT-ubuntu2004/python3. Failing tests: |
|
Build failed on windows10/default. Failing tests: |
|
Build failed on mac12arm/cxx20. Failing tests:
|
Closes #13605.