MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / diff

Function diff

src/backend/cuda/diff.cpp:20–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19template<typename T>
20Array<T> diff(const Array<T> &in, const int dim, const bool isDiff2) {
21 const af::dim4 &iDims = in.dims();
22 af::dim4 oDims = iDims;
23 oDims[dim] -= (isDiff2 + 1);
24
25 if (iDims.elements() == 0 || oDims.elements() == 0) {
26 AF_ERROR("Elements are 0", AF_ERR_SIZE);
27 }
28
29 Array<T> out = createEmptyArray<T>(oDims);
30
31 kernel::diff<T>(out, in, in.ndims(), dim, isDiff2);
32
33 return out;
34}
35
36template<typename T>
37Array<T> diff1(const Array<T> &in, const int dim) {

Callers 1

elemWiseEqFunction · 0.50

Calls 3

dimsMethod · 0.45
elementsMethod · 0.45
ndimsMethod · 0.45

Tested by 1

elemWiseEqFunction · 0.40