Create an identity array with 1's in diagonal # Parameters - `dims` is the output Array dimensions # Return Values Identity matrix
(dims: Dim4)
| 360 | /// |
| 361 | /// Identity matrix |
| 362 | pub fn identity<T: HasAfEnum>(dims: Dim4) -> Array<T> { |
| 363 | let aftype = T::get_af_dtype(); |
| 364 | unsafe { |
| 365 | let mut temp: af_array = std::ptr::null_mut(); |
| 366 | let err_val = af_identity( |
| 367 | &mut temp as *mut af_array, |
| 368 | dims.ndims() as c_uint, |
| 369 | dims.get().as_ptr() as *const dim_t, |
| 370 | aftype as c_uint, |
| 371 | ); |
| 372 | HANDLE_ERROR(AfError::from(err_val)); |
| 373 | temp.into() |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | /// Create a diagonal matrix |
| 378 | /// |
nothing calls this directly
no test coverage detected