Trait arr_rs::core::operations::tiling::ArrayTiling
source · pub trait ArrayTiling<T: ArrayElement>where
Self: Sized + Clone,{
// Required method
fn repeat(
&self,
repeats: &[usize],
axis: Option<usize>
) -> Result<Array<T>, ArrayError>;
}
Expand description
ArrayTrait - Array Tiling functions
Required Methods§
sourcefn repeat(
&self,
repeats: &[usize],
axis: Option<usize>
) -> Result<Array<T>, ArrayError>
fn repeat( &self, repeats: &[usize], axis: Option<usize> ) -> Result<Array<T>, ArrayError>
Repeat each element of an array after themselves
Arguments
repeats
- number of repetitions for each element, broadcasted to fit the shape of the given axisaxis
- the axis along which to repeat. optional, if None, array is flattened
Examples
use arr_rs::prelude::*;
let arr = Array::<i32>::single(3);
assert_eq!(array![i32, 3, 3, 3, 3], arr.repeat(&vec![4], None));
let arr = Array::<i32>::new(vec![1, 2, 3, 4], vec![2, 2]);
assert_eq!(array!(i32, [[1, 2], [3, 4], [3, 4]]), arr.repeat(&vec![1, 2], Some(0)));