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

Function af_where

src/api/c/where.cpp:34–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34af_err af_where(af_array* idx, const af_array in) {
35 try {
36 const ArrayInfo& i_info = getInfo(in);
37 af_dtype type = i_info.getType();
38
39 if (i_info.ndims() == 0) {
40 return af_create_handle(idx, 0, nullptr, u32);
41 }
42
43 af_array res;
44 switch (type) {
45 case f32: res = where<float>(in); break;
46 case f64: res = where<double>(in); break;
47 case c32: res = where<cfloat>(in); break;
48 case c64: res = where<cdouble>(in); break;
49 case s32: res = where<int>(in); break;
50 case u32: res = where<uint>(in); break;
51 case s64: res = where<intl>(in); break;
52 case u64: res = where<uintl>(in); break;
53 case s16: res = where<short>(in); break;
54 case u16: res = where<ushort>(in); break;
55 case s8: res = where<schar>(in); break;
56 case u8: res = where<uchar>(in); break;
57 case b8: res = where<char>(in); break;
58 default: TYPE_ERROR(1, type);
59 }
60 swap(*idx, res);
61 }
62 CATCHALL
63
64 return AF_SUCCESS;
65}

Callers 3

homographyTestFunction · 0.50
whereTestFunction · 0.50
whereFunction · 0.50

Calls 4

swapFunction · 0.85
af_create_handleFunction · 0.70
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected