@@ -123,26 +123,26 @@ where
123123 /// split and one view after the split.
124124 ///
125125 /// **Panics** if `axis` or `index` is out of bounds.
126- ///
126+ ///
127127 /// **Examples:**
128128 /// ```rust
129129 /// # use ndarray::prelude::*;
130- /// let a = array! [[0, 1, 2, 3],
131- /// [4, 5, 6, 7],
132- /// [8, 9, 0, 1]];
130+ /// let a = aview2(& [[0, 1, 2, 3],
131+ /// [4, 5, 6, 7],
132+ /// [8, 9, 0, 1]]) ;
133133 ///
134134 /// ```
135- /// The array `a` has two axes and shape 3 × 4:
135+ /// The array view `a` has two axes and shape 3 × 4:
136136 /// ```text
137- /// ─> Axis(1)
138- /// ┌───┬───┬───┬───┐ 0
139- /// │ │ 0 │ 1 │ 2 │ 3 │
140- /// v ├───┼───┼───┼───┤ 1
141- /// Axis(0)│ 4 │ 5 │ 6 │ 7 │
142- /// ├───┼───┼───┼───┤ 2
143- /// │ 8 │ 9 │ 0 │ 1 │
144- /// └───┴───┴───┴───┘ 3 ↑
145- /// 0 1 2 3 4 ← possible split_at indices.
137+ /// ──▶ Axis(1)
138+ /// ┌───── ┬───── ┬───── ┬─────┐ 0
139+ /// │ │ a₀₀ │ a₀₁ │ a₀₂ │ a₀₃ │
140+ /// ▼ ├───── ┼───── ┼───── ┼─────┤ 1
141+ /// Axis(0)│ a₁₀ │ a₁₁ │ a₁₂ │ a₁₃ │
142+ /// ├───── ┼───── ┼───── ┼─────┤ 2
143+ /// │ a₂₀ │ a₂₁ │ a₂₂ │ a₂₃ │
144+ /// └───── ┴───── ┴───── ┴─────┘ 3 ↑
145+ /// 0 1 2 3 4 ← possible split_at indices.
146146 /// ```
147147 ///
148148 /// Row indices increase along `Axis(0)`, and column indices increase along
@@ -152,45 +152,45 @@ where
152152 /// **Example 1**: Split `a` along the first axis, in this case the rows, at
153153 /// index 1.<br>
154154 /// This produces views v1 and v2 of shapes 1 × 4 and 2 × 4:
155- ///
155+ ///
156156 /// ```rust
157157 /// # use ndarray::prelude::*;
158- /// # let a = Array::from_elem((3, 3), 0 );
159- /// let (v1, v2) = a.view(). split_at(Axis(0), 1);
158+ /// # let a = aview2(&[[0; 4]; 3] );
159+ /// let (v1, v2) = a.split_at(Axis(0), 1);
160160 /// ```
161161 /// ```text
162- /// ┌───┬───┬───┬ ───┐ 0 ↓ indices
163- /// │ 0 │ 1 │ 2 │ 3 │ v1
164- /// │ └ ───┴───┴ ───┴───┘
165- /// v ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ 1
166- /// Axis(0)┌ ───┬───┬ ───┬───┐
167- /// │ 4 │ 5 │ 6 │ 7 │
168- /// ├ ───┼───┼ ───┼───┤ v2 2
169- /// │ 8 │ 9 │ 0 │ 1 │
170- /// └───┴───┴───┴ ───┘ 3
162+ /// ┌───── ┬───── ┬─────┬── ───┐ 0 ↓ indices
163+ /// │ a₀₀ │ a₀₁ │ a₀₂ │ a₀₃ │ along Axis(0)
164+ /// ├ ─────┼─ ────┼─────┼─────┤ v1 1
165+ /// │ a₁₀ │ a₁₁ │ a₁₂ │ a₁₃ │
166+ /// └ ─────┴─ ────┴─────┴─────┘
167+ /// ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ 2
168+ /// ┌ ─────┬─ ────┬─────┬─────┐
169+ /// │ a₂₀ │ a₂₁ │ a₂₂ │ a₂₃ │ v2
170+ /// └───── ┴───── ┴─────┴── ───┘ 3
171171 /// ```
172- ///
172+ ///
173173 /// **Example 2**: Split `a` along the second axis, in this case the
174174 /// columns, at index 2.<br>
175175 /// This produces views u1 and u2 of shapes 3 × 2 and 3 × 2:
176176 ///
177177 /// ```rust
178178 /// # use ndarray::prelude::*;
179- /// # let a = Array::from_elem((3, 3), 0 );
180- /// let (u1, u2) = a.view(). split_at(Axis(1), 2);
179+ /// # let a = aview2(&[[0; 4]; 3] );
180+ /// let (u1, u2) = a.split_at(Axis(1), 2);
181181 ///
182182 /// ```
183183 /// ```text
184- /// u1 u2
185- /// 0 1 2 3 4 indices →
186- /// ┌───┬───┐┊┌───┬───┐
187- /// │ 0 │ 1 │┊│ 2 │ 3 │
188- /// ├───┼───┤┊├───┼───┤
189- /// │ 4 │ 5 │┊│ 6 │ 7 │
190- /// ├───┼───┤┊├───┼───┤
191- /// │ 8 │ 9 │┊│ 0 │ 1 │
192- /// └───┴───┘┊└───┴───┘
193- /// ─> Axis(1)
184+ /// u1 u2
185+ /// ┌─────┬─────┐┊┌─────┬─────┐
186+ /// │ a₀₀ │ a₀₁ │┊│ a₀₂ │ a₀₃ │
187+ /// ├─────┼─────┤┊├─────┼─────┤
188+ /// │ a₁₀ │ a₁₁ │┊│ a₁₂ │ a₁₃ │
189+ /// ├─────┼─────┤┊├─────┼─────┤
190+ /// │ a₂₀ │ a₂₁ │┊│ a₂₂ │ a₂₃ │
191+ /// └─────┴─────┘┊└─────┴─────┘
192+ /// 0 1 2 3 4 indices →
193+ /// along Axis(1)
194194 /// ```
195195 pub fn split_at ( self , axis : Axis , index : Ix ) -> ( Self , Self ) {
196196 unsafe {
0 commit comments