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

Function assign_gen

src/core/index.rs:613–631  ·  view source on GitHub ↗

Assign an Array to another after indexing it using any combination of Array's and Sequence's # Examples ```rust use arrayfire::{Array, Dim4, Seq, print, randu, constant, Indexer, assign_gen}; 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 mut a = randu:: (Dim4::new(&[5, 3, 1, 1])); // [5 3 1 1] /

(lhs: &mut Array<T>, indices: &Indexer, rhs: &Array<T>)

Source from the content-addressed store, hash-verified

611/// // 0.5328 0.9347 0.0535
612/// ```
613pub fn assign_gen<T>(lhs: &mut Array<T>, indices: &Indexer, rhs: &Array<T>)
614where
615 T: HasAfEnum,
616{
617 unsafe {
618 let mut temp: af_array = std::ptr::null_mut();
619 let err_val = af_assign_gen(
620 &mut temp as *mut af_array,
621 lhs.get() as af_array,
622 indices.len() as dim_t,
623 indices.get() as af_index_t,
624 rhs.get() as af_array,
625 );
626 HANDLE_ERROR(AfError::from(err_val));
627
628 let modified = temp.into();
629 let _old_arr = mem::replace(lhs, modified);
630 }
631}
632
633#[repr(C)]
634struct SeqInternal {

Callers 1

Calls 5

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

Tested by 1