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

Function iota

src/core/data.rs:336–351  ·  view source on GitHub ↗

Create a range of values Create an sequence [0, dims.elements() - 1] and modify to specified dimensions dims and then tile it according to tile_dims. # Parameters - `dims` is the dimensions of the sequence to be generated - `tdims` is the number of repitions of the unit dimensions # Return Values Array

(dims: Dim4, tdims: Dim4)

Source from the content-addressed store, hash-verified

334///
335/// Array
336pub fn iota<T: HasAfEnum>(dims: Dim4, tdims: Dim4) -> Array<T> {
337 let aftype = T::get_af_dtype();
338 unsafe {
339 let mut temp: af_array = std::ptr::null_mut();
340 let err_val = af_iota(
341 &mut temp as *mut af_array,
342 dims.ndims() as c_uint,
343 dims.get().as_ptr() as *const dim_t,
344 tdims.ndims() as c_uint,
345 tdims.get().as_ptr() as *const dim_t,
346 aftype as c_uint,
347 );
348 HANDLE_ERROR(AfError::from(err_val));
349 temp.into()
350 }
351}
352
353/// Create an identity array with 1's in diagonal
354///

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