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

Function replace

src/core/data.rs:887–895  ·  view source on GitHub ↗

Inplace replace in Array based on a condition This function does the C-equivalent of the following statement, except that the operation happens on a GPU for all elements simultaneously. ```text a = cond ? a : b; /// where cond, a & b are all objects of type Array ``` # Parameters - `a` is the Array whose element will be replaced with element from `b` if corresponding element in `cond` Array is

(a: &mut Array<T>, cond: &Array<bool>, b: &Array<T>)

Source from the content-addressed store, hash-verified

885///
886/// None
887pub fn replace<T>(a: &mut Array<T>, cond: &Array<bool>, b: &Array<T>)
888where
889 T: HasAfEnum,
890{
891 unsafe {
892 let err_val = af_replace(a.get() as *mut af_array, cond.get(), b.get());
893 HANDLE_ERROR(AfError::from(err_val));
894 }
895}
896
897/// Inplace replace in Array based on a condition
898///

Callers 2

assign_seqFunction · 0.85
assign_genFunction · 0.85

Calls 2

HANDLE_ERRORFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected