Replies: 2 comments 2 replies
-
With v2, Awkward Array is removing the mid-level C++ such that predominantly the kernels are left in C++. Whilst, for v1, there is a C++ layer, it will disappear. So, if you want to create Awkward Arrays from C++, your best bet is probably using e.g. pybind11 to invoke Python code: https://pybind11.readthedocs.io/en/stable/advanced/embedding.html In principle you can just return Python buffers and pass them to the zip function, but in practice I think we probably don't generalise all the way down to non-NumPy arrays, so you'd want to wrap each pointer in a NumPy array |
Beta Was this translation helpful? Give feedback.
-
@d-leroy - I think, you can try the following:
>>> A = np.array([1,2,3,4])
>>> B = np.array([1.1, 2.2, 3.3, 4.4, 5.5])
>>> C = np.array([1+0j, 2+2j, 3+3j])
>>> buffers = {"node1-data": A, "node2-data": B, "node3-data": C}
>>> array = ak._v2.from_buffers(form, 3, buffers)
>>> array
<Array [{A: 1, B: 1.1, C: 1+0j}, ..., {...}] type='3 * {A: int64, B: float6...'> |
Beta Was this translation helpful? Give feedback.
-
Hello,
Is it possible to build awkward arrays (more specifically record arrays) in C++ from various pointers to C++ arrays, to obtain what would basically be a awkward array "view" aggregated from several arrays that could then be exposed through an embedded Python interpreter?
Let's say I have arrays
A
,B
, andC
. I would like to aggregate them into an awkward record array of the form{"A": A, "B": B, "C": C}
, without copying data, to pass to the numba-jitted version of a Python function provided by the user.Note that those C++ arrays can be wrapped as numpy arrays if that helps.
Is this possible at all, and if it is, how I should go about doing this effectively?
Thanks in advance for the help!
Beta Was this translation helpful? Give feedback.
All reactions