Skip to content

Commit b073661

Browse files
committed
ixdyn: Use IxDyn function for example
1 parent 3dc47bb commit b073661

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/aliases.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,18 @@ pub type Ix5 = Dim<[Ix; 5]>;
6868
pub type Ix6 = Dim<[Ix; 6]>;
6969
/// dynamic-dimensional
7070
///
71-
/// `Vec<Ix>` and `&[usize]` implement `IntoDimension` to produce `IxDyn`;
72-
/// use them to create arrays with a dynamic number of axes.
71+
/// You can use the `IxDyn` function to create a dimension for an array with
72+
/// dynamic number of dimensions. (`Vec<Ix>` and `&[usize]` also implement
73+
/// `IntoDimension` to produce `IxDyn`).
7374
///
7475
/// ```
7576
/// use ndarray::ArrayD;
77+
/// use ndarray::IxDyn;
7678
///
7779
/// // Create a 5 × 6 × 3 × 4 array using the dynamic dimension type
78-
/// let mut a = ArrayD::<f64>::zeros(vec![5, 6, 3, 4]);
80+
/// let mut a = ArrayD::<f64>::zeros(IxDyn(&[5, 6, 3, 4]));
7981
/// // Create a 1 × 3 × 4 array using the dynamic dimension type
80-
/// let mut b = ArrayD::<f64>::zeros(vec![1, 3, 4]);
82+
/// let mut b = ArrayD::<f64>::zeros(IxDyn(&[1, 3, 4]));
8183
///
8284
/// // We can use broadcasting to add arrays of compatible shapes together:
8385
/// a += &b;

0 commit comments

Comments
 (0)