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

Method new_strided

src/core/array.rs:243–260  ·  view source on GitHub ↗

Constructs a new Array object from strided data The data pointed by the slice passed to this function can possibily be offseted using an additional `offset` parameter.

(slice: &[T], offset: i64, dims: Dim4, strides: Dim4)

Source from the content-addressed store, hash-verified

241 ///
242 /// The data pointed by the slice passed to this function can possibily be offseted using an additional `offset` parameter.
243 pub fn new_strided(slice: &[T], offset: i64, dims: Dim4, strides: Dim4) -> Self {
244 let aftype = T::get_af_dtype();
245 unsafe {
246 let mut temp: af_array = std::ptr::null_mut();
247 let err_val = af_create_strided_array(
248 &mut temp as *mut af_array,
249 slice.as_ptr() as *const c_void,
250 offset as dim_t,
251 dims.ndims() as c_uint,
252 dims.get().as_ptr() as *const c_longlong,
253 strides.get().as_ptr() as *const c_longlong,
254 aftype as c_uint,
255 1 as c_uint,
256 );
257 HANDLE_ERROR(AfError::from(err_val));
258 temp.into()
259 }
260 }
261
262 /// Constructs a new Array object of specified dimensions and type
263 ///

Callers

nothing calls this directly

Calls 4

HANDLE_ERRORFunction · 0.85
ndimsMethod · 0.80
intoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected