Trait 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§

Source

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 axis
  • axis - 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)));
§Errors

may returns ArrayError

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: ArrayElement> ArrayTiling<T> for Result<Array<T>, ArrayError>

Source§

fn repeat(&self, repeats: &[usize], axis: Option<usize>) -> Self

Implementors§