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

Function index

src/core/index.rs:263–281  ·  view source on GitHub ↗

Indexes the `input` Array using `seqs` Sequences # Examples ```rust use arrayfire::{Dim4, Seq, index, randu, print}; let dims = Dim4::new(&[5, 5, 1, 1]); let a = randu:: (dims); let seqs = &[Seq::new(1.0, 3.0, 1.0), Seq::default()]; let sub = index(&a, seqs); println!("a(seq(1, 3, 1), span)"); print(&sub); ```

(input: &Array<IO>, seqs: &[Seq<T>])

Source from the content-addressed store, hash-verified

261/// print(&sub);
262/// ```
263pub fn index<IO, T>(input: &Array<IO>, seqs: &[Seq<T>]) -> Array<IO>
264where
265 c_double: From<T>,
266 IO: HasAfEnum,
267 T: Copy + HasAfEnum + IndexableType,
268{
269 let seqs: Vec<SeqInternal> = seqs.iter().map(|s| SeqInternal::from_seq(s)).collect();
270 unsafe {
271 let mut temp: af_array = std::ptr::null_mut();
272 let err_val = af_index(
273 &mut temp as *mut af_array,
274 input.get(),
275 seqs.len() as u32,
276 seqs.as_ptr() as *const SeqInternal,
277 );
278 HANDLE_ERROR(AfError::from(err_val));
279 temp.into()
280 }
281}
282
283/// Extract `row_num` row from `input` Array
284///

Callers 10

seq_viewFunction · 0.85
rowFunction · 0.85
rowsFunction · 0.85
colFunction · 0.85
colsFunction · 0.85
sliceFunction · 0.85
slicesFunction · 0.85
non_macro_seq_indexFunction · 0.85
acoustic_wave_simulationFunction · 0.85
mainFunction · 0.85

Calls 4

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

Tested by 2

seq_viewFunction · 0.68
non_macro_seq_indexFunction · 0.68