MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / index_gen

Function index_gen

src/core/index.rs:564–579  ·  view source on GitHub ↗

Index an Array using any combination of Array's and Sequence's # Examples ```rust use arrayfire::{Array, Dim4, Seq, print, randu, index_gen, Indexer}; let values: [f32; 3] = [1.0, 2.0, 3.0]; let indices = Array::new(&values, Dim4::new(&[3, 1, 1, 1])); let seq4gen = Seq::new(0.0, 2.0, 1.0); let a = randu:: (Dim4::new(&[5, 3, 1, 1])); // [5 3 1 1] // 0.0000 0.2190 0.3835 // 0.1

(input: &Array<T>, indices: Indexer)

Source from the content-addressed store, hash-verified

562/// // 0.4587 0.6793 0.0346
563/// ```
564pub fn index_gen<T>(input: &Array<T>, indices: Indexer) -> Array<T>
565where
566 T: HasAfEnum,
567{
568 unsafe {
569 let mut temp: af_array = std::ptr::null_mut();
570 let err_val = af_index_gen(
571 &mut temp as *mut af_array,
572 input.get() as af_array,
573 indices.len() as dim_t,
574 indices.get() as af_index_t,
575 );
576 HANDLE_ERROR(AfError::from(err_val));
577 temp.into()
578 }
579}
580
581/// Assign an Array to another after indexing it using any combination of Array's and Sequence's
582///

Callers 2

mainFunction · 0.85

Calls 4

HANDLE_ERRORFunction · 0.85
lenMethod · 0.80
intoMethod · 0.80
getMethod · 0.45

Tested by 1