[][src]Function numas::factory::fill::ones

pub fn ones<T: Copy + From<u8>>(shape: Vec<i32>) -> Array<T>

Creates new array of given shape filled with ones

Arguments

  • shape - shape of new array

Examples

 use numas::array::Array;
 use numas::shape::Shape;

 let array = numas::factory::fill::ones::<i32>(vec![2, 2]);
 let data = array.collect();

 assert_eq!(data, vec![1 as i32; 4]);