/rust/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.17.2/src/zip/ndproducer.rs
Line | Count | Source |
1 | | use crate::imp_prelude::*; |
2 | | use crate::ArrayRef; |
3 | | use crate::Layout; |
4 | | use crate::NdIndex; |
5 | | #[cfg(not(feature = "std"))] |
6 | | use alloc::vec::Vec; |
7 | | |
8 | | /// Argument conversion into a producer. |
9 | | /// |
10 | | /// Slices and vectors can be used (equivalent to 1-dimensional array views). |
11 | | /// |
12 | | /// This trait is like `IntoIterator` for `NdProducers` instead of iterators. |
13 | | pub trait IntoNdProducer |
14 | | { |
15 | | /// The element produced per iteration. |
16 | | type Item; |
17 | | /// Dimension type of the producer |
18 | | type Dim: Dimension; |
19 | | /// The concrete type of the producer |
20 | | type Output: NdProducer<Dim = Self::Dim, Item = Self::Item>; |
21 | | /// Convert the value into an `NdProducer`. |
22 | | fn into_producer(self) -> Self::Output; |
23 | | } |
24 | | |
25 | | impl<P> IntoNdProducer for P |
26 | | where P: NdProducer |
27 | | { |
28 | | type Item = P::Item; |
29 | | type Dim = P::Dim; |
30 | | type Output = Self; |
31 | 0 | fn into_producer(self) -> Self::Output |
32 | | { |
33 | 0 | self |
34 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <_ as ndarray::zip::ndproducer::IntoNdProducer>::into_producer |
35 | | } |
36 | | |
37 | | /// A producer of an n-dimensional set of elements; |
38 | | /// for example an array view, mutable array view or an iterator |
39 | | /// that yields chunks. |
40 | | /// |
41 | | /// Producers are used as a arguments to [`Zip`](crate::Zip) and |
42 | | /// [`azip!()`]. |
43 | | /// |
44 | | /// # Comparison to `IntoIterator` |
45 | | /// |
46 | | /// Most `NdProducers` are *iterable* (implement `IntoIterator`) but not directly |
47 | | /// iterators. This separation is needed because the producer represents |
48 | | /// a multidimensional set of items, it can be split along a particular axis for |
49 | | /// parallelization, and it has no fixed correspondence to a sequence. |
50 | | /// |
51 | | /// The natural exception is one dimensional producers, like `AxisIter`, which |
52 | | /// implement `Iterator` directly |
53 | | /// (`AxisIter` traverses a one dimensional sequence, along an axis, while |
54 | | /// *producing* multidimensional items). |
55 | | /// |
56 | | /// See also [`IntoNdProducer`] |
57 | | pub trait NdProducer |
58 | | { |
59 | | /// The element produced per iteration. |
60 | | type Item; |
61 | | // Internal use / Pointee type |
62 | | /// Dimension type |
63 | | type Dim: Dimension; |
64 | | |
65 | | // The pointer Ptr is used by an array view to simply point to the |
66 | | // current element. It doesn't have to be a pointer (see Indices). |
67 | | // Its main function is that it can be incremented with a particular |
68 | | // stride (= along a particular axis) |
69 | | #[doc(hidden)] |
70 | | /// Pointer or stand-in for pointer |
71 | | type Ptr: Offset<Stride = Self::Stride>; |
72 | | #[doc(hidden)] |
73 | | /// Pointer stride |
74 | | type Stride: Copy; |
75 | | |
76 | | #[doc(hidden)] |
77 | | fn layout(&self) -> Layout; |
78 | | /// Return the shape of the producer. |
79 | | fn raw_dim(&self) -> Self::Dim; |
80 | | #[doc(hidden)] |
81 | 0 | fn equal_dim(&self, dim: &Self::Dim) -> bool |
82 | | { |
83 | 0 | self.raw_dim() == *dim |
84 | 0 | } |
85 | | #[doc(hidden)] |
86 | | fn as_ptr(&self) -> Self::Ptr; |
87 | | #[doc(hidden)] |
88 | | unsafe fn as_ref(&self, ptr: Self::Ptr) -> Self::Item; |
89 | | #[doc(hidden)] |
90 | | unsafe fn uget_ptr(&self, i: &Self::Dim) -> Self::Ptr; |
91 | | #[doc(hidden)] |
92 | | fn stride_of(&self, axis: Axis) -> <Self::Ptr as Offset>::Stride; |
93 | | #[doc(hidden)] |
94 | | fn contiguous_stride(&self) -> Self::Stride; |
95 | | #[doc(hidden)] |
96 | | fn split_at(self, axis: Axis, index: usize) -> (Self, Self) |
97 | | where Self: Sized; |
98 | | |
99 | | private_decl! {} |
100 | | } |
101 | | |
102 | | pub trait Offset: Copy |
103 | | { |
104 | | type Stride: Copy; |
105 | | unsafe fn stride_offset(self, s: Self::Stride, index: usize) -> Self; |
106 | | private_decl! {} |
107 | | } |
108 | | |
109 | | impl<T> Offset for *const T |
110 | | { |
111 | | type Stride = isize; |
112 | 0 | unsafe fn stride_offset(self, s: Self::Stride, index: usize) -> Self |
113 | | { |
114 | 0 | self.offset(s * (index as isize)) |
115 | 0 | } |
116 | | private_impl! {} |
117 | | } |
118 | | |
119 | | impl<T> Offset for *mut T |
120 | | { |
121 | | type Stride = isize; |
122 | 0 | unsafe fn stride_offset(self, s: Self::Stride, index: usize) -> Self |
123 | | { |
124 | 0 | self.offset(s * (index as isize)) |
125 | 0 | } Unexecuted instantiation: <*mut half::binary16::f16 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut i8 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut f64 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut f32 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut u8 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut i32 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut i16 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut i64 as ndarray::zip::ndproducer::Offset>::stride_offset Unexecuted instantiation: <*mut _ as ndarray::zip::ndproducer::Offset>::stride_offset |
126 | | private_impl! {} |
127 | | } |
128 | | |
129 | | /// An array reference is an n-dimensional producer of element references |
130 | | /// (like ArrayView). |
131 | | impl<'a, A: 'a, S, D> IntoNdProducer for &'a ArrayBase<S, D> |
132 | | where |
133 | | D: Dimension, |
134 | | S: Data<Elem = A>, |
135 | | { |
136 | | type Item = &'a A; |
137 | | type Dim = D; |
138 | | type Output = ArrayView<'a, A, D>; |
139 | 0 | fn into_producer(self) -> Self::Output |
140 | | { |
141 | 0 | self.view() |
142 | 0 | } Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayBase<_, _, _> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer |
143 | | } |
144 | | |
145 | | /// A mutable array reference is an n-dimensional producer of mutable element |
146 | | /// references (like ArrayViewMut). |
147 | | impl<'a, A: 'a, S, D> IntoNdProducer for &'a mut ArrayBase<S, D> |
148 | | where |
149 | | D: Dimension, |
150 | | S: DataMut<Elem = A>, |
151 | | { |
152 | | type Item = &'a mut A; |
153 | | type Dim = D; |
154 | | type Output = ArrayViewMut<'a, A, D>; |
155 | 0 | fn into_producer(self) -> Self::Output |
156 | | { |
157 | 0 | self.view_mut() |
158 | 0 | } |
159 | | } |
160 | | |
161 | | /// An array reference is an n-dimensional producer of element references |
162 | | /// (like ArrayView). |
163 | | impl<'a, A: 'a, D> IntoNdProducer for &'a ArrayRef<A, D> |
164 | | where D: Dimension |
165 | | { |
166 | | type Item = &'a A; |
167 | | type Dim = D; |
168 | | type Output = ArrayView<'a, A, D>; |
169 | 0 | fn into_producer(self) -> Self::Output |
170 | | { |
171 | 0 | self.view() |
172 | 0 | } Unexecuted instantiation: <&ndarray::ArrayRef<half::binary16::f16, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<i8, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<f64, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<f32, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<u8, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<i32, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<i16, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<i64, ndarray::dimension::dim::Dim<[usize; 1]>> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer Unexecuted instantiation: <&ndarray::ArrayRef<_, _> as ndarray::zip::ndproducer::IntoNdProducer>::into_producer |
173 | | } |
174 | | |
175 | | /// A mutable array reference is an n-dimensional producer of mutable element |
176 | | /// references (like ArrayViewMut). |
177 | | impl<'a, A: 'a, D> IntoNdProducer for &'a mut ArrayRef<A, D> |
178 | | where D: Dimension |
179 | | { |
180 | | type Item = &'a mut A; |
181 | | type Dim = D; |
182 | | type Output = ArrayViewMut<'a, A, D>; |
183 | 0 | fn into_producer(self) -> Self::Output |
184 | | { |
185 | 0 | self.view_mut() |
186 | 0 | } |
187 | | } |
188 | | |
189 | | /// A slice is a one-dimensional producer |
190 | | impl<'a, A: 'a> IntoNdProducer for &'a [A] |
191 | | { |
192 | | type Item = <Self::Output as NdProducer>::Item; |
193 | | type Dim = Ix1; |
194 | | type Output = ArrayView1<'a, A>; |
195 | 0 | fn into_producer(self) -> Self::Output |
196 | | { |
197 | 0 | <_>::from(self) |
198 | 0 | } |
199 | | } |
200 | | |
201 | | /// A mutable slice is a mutable one-dimensional producer |
202 | | impl<'a, A: 'a> IntoNdProducer for &'a mut [A] |
203 | | { |
204 | | type Item = <Self::Output as NdProducer>::Item; |
205 | | type Dim = Ix1; |
206 | | type Output = ArrayViewMut1<'a, A>; |
207 | 0 | fn into_producer(self) -> Self::Output |
208 | | { |
209 | 0 | <_>::from(self) |
210 | 0 | } |
211 | | } |
212 | | |
213 | | /// A one-dimensional array is a one-dimensional producer |
214 | | impl<'a, A: 'a, const N: usize> IntoNdProducer for &'a [A; N] |
215 | | { |
216 | | type Item = <Self::Output as NdProducer>::Item; |
217 | | type Dim = Ix1; |
218 | | type Output = ArrayView1<'a, A>; |
219 | 0 | fn into_producer(self) -> Self::Output |
220 | | { |
221 | 0 | <_>::from(self) |
222 | 0 | } |
223 | | } |
224 | | |
225 | | /// A mutable one-dimensional array is a mutable one-dimensional producer |
226 | | impl<'a, A: 'a, const N: usize> IntoNdProducer for &'a mut [A; N] |
227 | | { |
228 | | type Item = <Self::Output as NdProducer>::Item; |
229 | | type Dim = Ix1; |
230 | | type Output = ArrayViewMut1<'a, A>; |
231 | 0 | fn into_producer(self) -> Self::Output |
232 | | { |
233 | 0 | <_>::from(self) |
234 | 0 | } |
235 | | } |
236 | | |
237 | | /// A Vec is a one-dimensional producer |
238 | | impl<'a, A: 'a> IntoNdProducer for &'a Vec<A> |
239 | | { |
240 | | type Item = <Self::Output as NdProducer>::Item; |
241 | | type Dim = Ix1; |
242 | | type Output = ArrayView1<'a, A>; |
243 | 0 | fn into_producer(self) -> Self::Output |
244 | | { |
245 | 0 | <_>::from(self) |
246 | 0 | } |
247 | | } |
248 | | |
249 | | /// A mutable Vec is a mutable one-dimensional producer |
250 | | impl<'a, A: 'a> IntoNdProducer for &'a mut Vec<A> |
251 | | { |
252 | | type Item = <Self::Output as NdProducer>::Item; |
253 | | type Dim = Ix1; |
254 | | type Output = ArrayViewMut1<'a, A>; |
255 | 0 | fn into_producer(self) -> Self::Output |
256 | | { |
257 | 0 | <_>::from(self) |
258 | 0 | } |
259 | | } |
260 | | |
261 | | impl<'a, A, D: Dimension> NdProducer for ArrayView<'a, A, D> |
262 | | { |
263 | | type Item = &'a A; |
264 | | type Dim = D; |
265 | | type Ptr = *mut A; |
266 | | type Stride = isize; |
267 | | |
268 | | private_impl! {} |
269 | | |
270 | 0 | fn raw_dim(&self) -> Self::Dim |
271 | | { |
272 | 0 | (***self).raw_dim() |
273 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::raw_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::raw_dim |
274 | | |
275 | 0 | fn equal_dim(&self, dim: &Self::Dim) -> bool |
276 | | { |
277 | 0 | self._dim().equal(dim) |
278 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::equal_dim |
279 | | |
280 | 0 | fn as_ptr(&self) -> *mut A |
281 | | { |
282 | 0 | (**self).as_ptr() as _ |
283 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::as_ptr |
284 | | |
285 | 0 | fn layout(&self) -> Layout |
286 | | { |
287 | 0 | self.layout_impl() |
288 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::layout |
289 | | |
290 | 0 | unsafe fn as_ref(&self, ptr: *mut A) -> Self::Item |
291 | | { |
292 | 0 | &*ptr |
293 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::as_ref |
294 | | |
295 | 0 | unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A |
296 | | { |
297 | 0 | self._ptr() |
298 | 0 | .as_ptr() |
299 | 0 | .offset(i.index_unchecked(self._strides())) |
300 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::uget_ptr |
301 | | |
302 | 0 | fn stride_of(&self, axis: Axis) -> isize |
303 | | { |
304 | 0 | (**self).stride_of(axis) |
305 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::stride_of |
306 | | |
307 | | #[inline(always)] |
308 | 0 | fn contiguous_stride(&self) -> Self::Stride |
309 | | { |
310 | 0 | 1 |
311 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&half::binary16::f16>, ndarray::dimension::dim::Dim<[usize; 1]>, half::binary16::f16> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i8>, ndarray::dimension::dim::Dim<[usize; 1]>, i8> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&u8>, ndarray::dimension::dim::Dim<[usize; 1]>, u8> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i32>, ndarray::dimension::dim::Dim<[usize; 1]>, i32> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i16>, ndarray::dimension::dim::Dim<[usize; 1]>, i16> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&i64>, ndarray::dimension::dim::Dim<[usize; 1]>, i64> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::ViewRepr<&_>, _, _> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride |
312 | | |
313 | 0 | fn split_at(self, axis: Axis, index: usize) -> (Self, Self) |
314 | | { |
315 | 0 | self.split_at(axis, index) |
316 | 0 | } |
317 | | } |
318 | | |
319 | | impl<'a, A, D: Dimension> NdProducer for ArrayViewMut<'a, A, D> |
320 | | { |
321 | | type Item = &'a mut A; |
322 | | type Dim = D; |
323 | | type Ptr = *mut A; |
324 | | type Stride = isize; |
325 | | |
326 | | private_impl! {} |
327 | | |
328 | 0 | fn raw_dim(&self) -> Self::Dim |
329 | | { |
330 | 0 | (***self).raw_dim() |
331 | 0 | } |
332 | | |
333 | 0 | fn equal_dim(&self, dim: &Self::Dim) -> bool |
334 | | { |
335 | 0 | self._dim().equal(dim) |
336 | 0 | } |
337 | | |
338 | 0 | fn as_ptr(&self) -> *mut A |
339 | | { |
340 | 0 | (**self).as_ptr() as _ |
341 | 0 | } |
342 | | |
343 | 0 | fn layout(&self) -> Layout |
344 | | { |
345 | 0 | self.layout_impl() |
346 | 0 | } |
347 | | |
348 | 0 | unsafe fn as_ref(&self, ptr: *mut A) -> Self::Item |
349 | | { |
350 | 0 | &mut *ptr |
351 | 0 | } |
352 | | |
353 | 0 | unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A |
354 | | { |
355 | 0 | self._ptr() |
356 | 0 | .as_ptr() |
357 | 0 | .offset(i.index_unchecked(self._strides())) |
358 | 0 | } |
359 | | |
360 | 0 | fn stride_of(&self, axis: Axis) -> isize |
361 | | { |
362 | 0 | (**self).stride_of(axis) |
363 | 0 | } |
364 | | |
365 | | #[inline(always)] |
366 | 0 | fn contiguous_stride(&self) -> Self::Stride |
367 | | { |
368 | 0 | 1 |
369 | 0 | } |
370 | | |
371 | 0 | fn split_at(self, axis: Axis, index: usize) -> (Self, Self) |
372 | | { |
373 | 0 | self.split_at(axis, index) |
374 | 0 | } |
375 | | } |
376 | | |
377 | | impl<A, D: Dimension> NdProducer for RawArrayView<A, D> |
378 | | { |
379 | | type Item = *const A; |
380 | | type Dim = D; |
381 | | type Ptr = *const A; |
382 | | type Stride = isize; |
383 | | |
384 | | private_impl! {} |
385 | | |
386 | 0 | fn raw_dim(&self) -> Self::Dim |
387 | | { |
388 | 0 | self.raw_dim() |
389 | 0 | } |
390 | | |
391 | 0 | fn equal_dim(&self, dim: &Self::Dim) -> bool |
392 | | { |
393 | 0 | self.parts.dim.equal(dim) |
394 | 0 | } |
395 | | |
396 | 0 | fn as_ptr(&self) -> *const A |
397 | | { |
398 | 0 | self.as_ptr() as _ |
399 | 0 | } |
400 | | |
401 | 0 | fn layout(&self) -> Layout |
402 | | { |
403 | 0 | AsRef::<LayoutRef<_, _>>::as_ref(self).layout_impl() |
404 | 0 | } |
405 | | |
406 | 0 | unsafe fn as_ref(&self, ptr: *const A) -> *const A |
407 | | { |
408 | 0 | ptr |
409 | 0 | } |
410 | | |
411 | 0 | unsafe fn uget_ptr(&self, i: &Self::Dim) -> *const A |
412 | | { |
413 | 0 | self.parts |
414 | 0 | .ptr |
415 | 0 | .as_ptr() |
416 | 0 | .offset(i.index_unchecked(&self.parts.strides)) |
417 | 0 | } |
418 | | |
419 | 0 | fn stride_of(&self, axis: Axis) -> isize |
420 | | { |
421 | 0 | self.stride_of(axis) |
422 | 0 | } |
423 | | |
424 | | #[inline(always)] |
425 | 0 | fn contiguous_stride(&self) -> Self::Stride |
426 | | { |
427 | 0 | 1 |
428 | 0 | } |
429 | | |
430 | 0 | fn split_at(self, axis: Axis, index: usize) -> (Self, Self) |
431 | | { |
432 | 0 | self.split_at(axis, index) |
433 | 0 | } |
434 | | } |
435 | | |
436 | | impl<A, D: Dimension> NdProducer for RawArrayViewMut<A, D> |
437 | | { |
438 | | type Item = *mut A; |
439 | | type Dim = D; |
440 | | type Ptr = *mut A; |
441 | | type Stride = isize; |
442 | | |
443 | | private_impl! {} |
444 | | |
445 | 0 | fn raw_dim(&self) -> Self::Dim |
446 | | { |
447 | 0 | self.raw_dim() |
448 | 0 | } |
449 | | |
450 | 0 | fn equal_dim(&self, dim: &Self::Dim) -> bool |
451 | | { |
452 | 0 | self.parts.dim.equal(dim) |
453 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::equal_dim Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::equal_dim |
454 | | |
455 | 0 | fn as_ptr(&self) -> *mut A |
456 | | { |
457 | 0 | self.as_ptr() as _ |
458 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::as_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::as_ptr |
459 | | |
460 | 0 | fn layout(&self) -> Layout |
461 | | { |
462 | 0 | AsRef::<LayoutRef<_, _>>::as_ref(self).layout_impl() |
463 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::layout Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::layout |
464 | | |
465 | 0 | unsafe fn as_ref(&self, ptr: *mut A) -> *mut A |
466 | | { |
467 | 0 | ptr |
468 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::as_ref Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::as_ref |
469 | | |
470 | 0 | unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A |
471 | | { |
472 | 0 | self.parts |
473 | 0 | .ptr |
474 | 0 | .as_ptr() |
475 | 0 | .offset(i.index_unchecked(&self.parts.strides)) |
476 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::uget_ptr Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::uget_ptr |
477 | | |
478 | 0 | fn stride_of(&self, axis: Axis) -> isize |
479 | | { |
480 | 0 | self.stride_of(axis) |
481 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::stride_of Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::stride_of |
482 | | |
483 | | #[inline(always)] |
484 | 0 | fn contiguous_stride(&self) -> Self::Stride |
485 | | { |
486 | 0 | 1 |
487 | 0 | } Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f64>, ndarray::dimension::dim::Dim<[usize; 1]>, f64> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut f32>, ndarray::dimension::dim::Dim<[usize; 1]>, f32> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride Unexecuted instantiation: <ndarray::ArrayBase<ndarray::RawViewRepr<*mut _>, _, _> as ndarray::zip::ndproducer::NdProducer>::contiguous_stride |
488 | | |
489 | 0 | fn split_at(self, axis: Axis, index: usize) -> (Self, Self) |
490 | | { |
491 | 0 | self.split_at(axis, index) |
492 | 0 | } |
493 | | } |