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

Function af_mean

src/api/c/mean.cpp:65–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65af_err af_mean(af_array *out, const af_array in, const dim_t dim) {
66 try {
67 ARG_ASSERT(2, (dim >= 0 && dim <= 3));
68
69 af_array output = 0;
70 const ArrayInfo &info = getInfo(in);
71 af_dtype type = info.getType();
72 switch (type) {
73 case f64: output = mean<double, double>(in, dim); break;
74 case f32: output = mean<float, float>(in, dim); break;
75 case s32: output = mean<int, float>(in, dim); break;
76 case u32: output = mean<unsigned, float>(in, dim); break;
77 case s64: output = mean<intl, double>(in, dim); break;
78 case u64: output = mean<uintl, double>(in, dim); break;
79 case s16: output = mean<short, float>(in, dim); break;
80 case u16: output = mean<ushort, float>(in, dim); break;
81 case s8: output = mean<schar, float>(in, dim); break;
82 case u8: output = mean<uchar, float>(in, dim); break;
83 case b8: output = mean<char, float>(in, dim); break;
84 case c32: output = mean<cfloat, cfloat>(in, dim); break;
85 case c64: output = mean<cdouble, cdouble>(in, dim); break;
86 case f16: output = mean<half, half>(in, dim); break;
87 default: TYPE_ERROR(1, type);
88 }
89 std::swap(*out, output);
90 }
91 CATCHALL;
92 return AF_SUCCESS;
93}
94
95af_err af_mean_weighted(af_array *out, const af_array in,
96 const af_array weights, const dim_t dim) {

Callers 1

meanFunction · 0.50

Calls 2

swapFunction · 0.85
getTypeMethod · 0.45

Tested by

no test coverage detected