You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrap the Python array `x` as a Julia `AbstractArray{T,N}`.
58
+
59
+
The input `x` can be `bytes`, `bytearray`, `array.array`, `numpy.ndarray` or anything satisfying the buffer protocol (if `buffer=true`) or the numpy array interface (if `array=true`).
60
+
61
+
If `copy=false` then the resulting array is guaranteed to directly wrap the data in `x`. If `copy=true` then a copy is taken if necessary to produce an array.
62
+
63
+
The type parameters are all optional, and are:
64
+
- `T`: The element type.
65
+
- `N`: The number of dimensions.
66
+
- `M`: True if the array is mutable.
67
+
- `L`: True if the array supports fast linear indexing.
68
+
- `R`: The element type of the underlying buffer. Often equal to `T`.
69
+
"""
70
+
struct PyArray{T,N,M,L,R} <:AbstractArray{T,N}
71
+
ptr::Ptr{R}# pointer to the data
72
+
length::Int# length of the array
73
+
size::NTuple{N,Int}# size of the array
74
+
strides::NTuple{N,Int}# strides (in bytes) between elements
75
+
py::Py# underlying python object
76
+
handle::Py# the data in this array is valid as long as this handle is alive
Wrap the Python array `x` as a Julia `AbstractArray{T,N}`.
9
-
10
-
The input `x` can be `bytes`, `bytearray`, `array.array`, `numpy.ndarray` or anything satisfying the buffer protocol (if `buffer=true`) or the numpy array interface (if `array=true`).
11
-
12
-
If `copy=false` then the resulting array is guaranteed to directly wrap the data in `x`. If `copy=true` then a copy is taken if necessary to produce an array.
13
-
14
-
The type parameters are all optional, and are:
15
-
- `T`: The element type.
16
-
- `N`: The number of dimensions.
17
-
- `M`: True if the array is mutable.
18
-
- `L`: True if the array supports fast linear indexing.
19
-
- `R`: The element type of the underlying buffer. Often equal to `T`.
20
-
"""
21
-
struct PyArray{T,N,M,L,R} <:AbstractArray{T,N}
22
-
ptr::Ptr{R}# pointer to the data
23
-
length::Int# length of the array
24
-
size::NTuple{N,Int}# size of the array
25
-
strides::NTuple{N,Int}# strides (in bytes) between elements
26
-
py::Py# underlying python object
27
-
handle::Py# the data in this array is valid as long as this handle is alive
0 commit comments