@@ -217,29 +217,36 @@ pub type Ixs = isize;
217
217
///
218
218
/// ## Indexing and Dimension
219
219
///
220
- /// Array indexes are represented by the types `Ix` and `Ixs` (signed).
221
- ///
222
220
/// The dimensionality of the array determines the number of *axes*, for example
223
221
/// a 2D array has two axes. These are listed in “big endian” order, so that
224
222
/// the greatest dimension is listed first, the lowest dimension with the most
225
223
/// rapidly varying index is the last.
226
224
///
227
- /// In a 2D array the index of each element is `( row, column)`
228
- /// as seen in this 3 × 3 example:
225
+ /// In a 2D array the index of each element is `[ row, column]` as seen in this
226
+ /// 4 × 3 example:
229
227
///
230
228
/// ```ignore
231
- /// [[ (0, 0), (0, 1), (0, 2)], // row 0
232
- /// [ (1, 0), (1, 1), (1, 2)], // row 1
233
- /// [ (2, 0), (2, 1), (2, 2)]] // row 2
229
+ /// [[ [0, 0], [0, 1], [0, 2] ], // row 0
230
+ /// [ [1, 0], [1, 1], [1, 2] ], // row 1
231
+ /// [ [2, 0], [2, 1], [2, 2] ], // row 2
232
+ /// [ [3, 0], [3, 1], [3, 2] ]] // row 3
234
233
/// // \ \ \
235
234
/// // column 0 \ column 2
236
235
/// // column 1
237
236
/// ```
238
237
///
239
- /// The number of axes for an array is fixed by the `D` parameter: `Ix` for
240
- /// a 1D array, `(Ix, Ix)` for a 2D array etc. The `D` type is also used
241
- /// for element indices in `.get()` and `array[index]`. The dimension type `Vec<Ix>`
242
- /// allows a dynamic number of axes.
238
+ /// The number of axes for an array is fixed by its `D` type parameter: `Ix1`
239
+ /// for a 1D array, `Ix2` for a 2D array etc. The dimension type `IxDyn` allows
240
+ /// a dynamic number of axes.
241
+ ///
242
+ /// An array of the corresponding dimensionality is used to index the array,
243
+ /// making the syntax `array[[` i, j, ...`]]`
244
+ ///
245
+ /// ```
246
+ /// use ndarray::Array2;
247
+ /// let mut array = Array2::zeros((4, 3));
248
+ /// array[[1, 1]] = 7;
249
+ /// ```
243
250
///
244
251
/// The default memory order of an array is *row major* order (a.k.a “c” order),
245
252
/// where each row is contiguous in memory.
0 commit comments