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

Function af_flat

src/api/c/moddims.cpp:86–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86af_err af_flat(af_array* out, const af_array in) {
87 try {
88 const ArrayInfo& info = getInfo(in);
89
90 if (info.ndims() == 1) {
91 *out = retain(in);
92 } else {
93 af_array output = 0;
94 af_dtype type = info.getType();
95
96 switch (type) {
97 case f32: output = flat<float>(in); break;
98 case c32: output = flat<cfloat>(in); break;
99 case f64: output = flat<double>(in); break;
100 case c64: output = flat<cdouble>(in); break;
101 case b8: output = flat<char>(in); break;
102 case s32: output = flat<int>(in); break;
103 case u32: output = flat<uint>(in); break;
104 case s8: output = flat<schar>(in); break;
105 case u8: output = flat<uchar>(in); break;
106 case s64: output = flat<intl>(in); break;
107 case u64: output = flat<uintl>(in); break;
108 case s16: output = flat<short>(in); break;
109 case u16: output = flat<ushort>(in); break;
110 case f16: output = flat<half>(in); break;
111 default: TYPE_ERROR(1, type);
112 }
113 std::swap(*out, output);
114 }
115 }
116 CATCHALL;
117 return AF_SUCCESS;
118}

Callers 6

hist_equalFunction · 0.70
af_index_genFunction · 0.70
af_assign_seqFunction · 0.70
af_assign_genFunction · 0.70
flatFunction · 0.50
array.cppFile · 0.50

Calls 4

retainFunction · 0.85
swapFunction · 0.85
ndimsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected