@@ -125,6 +125,8 @@ impl Drop for Indexer {
125125/// # Examples
126126///
127127/// ```
128+ /// use arrayfire::{Dim4, Seq, index, randu, print};
129+ /// let dims = Dim4::new(&[5, 5, 1, 1]);
128130/// let a = randu::<f32>(dims).unwrap();
129131/// let seqs = &[Seq::new(1.0, 3.0, 1.0), Seq::default()];
130132/// let sub = index(&a, seqs).unwrap();
@@ -153,10 +155,12 @@ pub fn index<T: Copy>(input: &Array, seqs: &[Seq<T>]) -> Result<Array, AfError>
153155/// # Examples
154156///
155157/// ```
158+ /// use arrayfire::{Dim4, randu, row, print};
159+ /// let dims = Dim4::new(&[5, 5, 1, 1]);
156160/// let a = randu::<f32>(dims).unwrap();
157161/// println!("Grab last row of the random matrix");
158162/// print(&a);
159- /// print(&row(&a, num_rows - 1 ).unwrap());
163+ /// print(&row(&a, 4 ).unwrap());
160164/// ```
161165#[ allow( dead_code) ]
162166pub fn row ( input : & Array , row_num : u64 ) -> Result < Array , AfError > {
@@ -189,10 +193,12 @@ pub fn set_rows(input: &Array, new_rows: &Array, first: u64, last: u64) -> Resul
189193/// # Examples
190194///
191195/// ```
196+ /// use arrayfire::{Dim4, randu, col, print};
197+ /// let dims = Dim4::new(&[5, 5, 1, 1]);
192198/// let a = randu::<f32>(dims).unwrap();
193199/// println!("Grab last col of the random matrix");
194200/// print(&a);
195- /// print(&row (&a, num_cols - 1 ).unwrap());
201+ /// print(&col (&a, 4 ).unwrap());
196202/// ```
197203#[ allow( dead_code) ]
198204pub fn col ( input : & Array , col_num : u64 ) -> Result < Array , AfError > {
@@ -287,6 +293,7 @@ pub fn lookup(input: &Array, indices: &Array, seq_dim: i32) -> Result<Array, AfE
287293/// # Examples
288294///
289295/// ```
296+ /// use arrayfire::{constant, Dim4, Seq, assign_seq, print};
290297/// let a = constant(2.0 as f32, Dim4::new(&[5, 3, 1, 1])).unwrap();
291298/// let b = constant(1.0 as f32, Dim4::new(&[3, 3, 1, 1])).unwrap();
292299/// let seqs = &[Seq::new(1.0, 3.0, 1.0), Seq::default()];
@@ -327,6 +334,7 @@ pub fn assign_seq<T: Copy>(lhs: &Array, seqs: &[Seq<T>], rhs: &Array) -> Result<
327334/// # Examples
328335///
329336/// ```
337+ /// use arrayfire::{Array, Dim4, Seq, print, randu, index_gen, Indexer};
330338/// let values: &[f32] = &[1.0, 2.0, 3.0];
331339/// let indices = Array::new(values, Dim4::new(&[3, 1, 1, 1])).unwrap();
332340/// let seq4gen = Seq::new(0.0, 2.0, 1.0);
@@ -370,6 +378,7 @@ pub fn index_gen(input: &Array, indices: Indexer) -> Result<Array, AfError> {
370378/// # Examples
371379///
372380/// ```
381+ /// use arrayfire::{Array, Dim4, Seq, print, randu, constant, Indexer, assign_gen};
373382/// let values: &[f32] = &[1.0, 2.0, 3.0];
374383/// let indices = Array::new(values, Dim4::new(&[3, 1, 1, 1])).unwrap();
375384/// let seq4gen = Seq::new(0.0, 2.0, 1.0);
@@ -390,7 +399,7 @@ pub fn index_gen(input: &Array, indices: Indexer) -> Result<Array, AfError> {
390399/// idxrs.set_index(&indices, 0, None); // 2nd parameter is indexing dimension
391400/// idxrs.set_index(&seq4gen, 1, Some(false)); // 3rd parameter indicates batch operation
392401///
393- /// let sub2 = assign_gen(&a, idxrs, &b).unwrap();
402+ /// let sub2 = assign_gen(&a, & idxrs, &b).unwrap();
394403/// println!("a(indices, seq(0, 2, 1))"); print(&sub2);
395404/// // [5 3 1 1]
396405/// // 0.0000 0.2190 0.3835
0 commit comments