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

Function af_mean_all_weighted

src/api/c/mean.cpp:187–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187af_err af_mean_all_weighted(double *realVal, double *imagVal, const af_array in,
188 const af_array weights) {
189 try {
190 const ArrayInfo &iInfo = getInfo(in);
191 const ArrayInfo &wInfo = getInfo(weights);
192 af_dtype iType = iInfo.getType();
193 af_dtype wType = wInfo.getType();
194
195 ARG_ASSERT(
196 3,
197 (wType == f32 ||
198 wType ==
199 f64)); /* verify that weights are non-complex real numbers */
200
201 switch (iType) {
202 case f32:
203 case s32:
204 case u32:
205 case s16:
206 case u16:
207 case s8:
208 case u8:
209 case b8:
210 case f16: *realVal = mean<float>(in, weights); break;
211 case f64:
212 case s64:
213 case u64: *realVal = mean<double>(in, weights); break;
214 case c32: {
215 cfloat tmp = mean<cfloat>(in, weights);
216 *realVal = real(tmp);
217 *imagVal = imag(tmp);
218 } break;
219 case c64: {
220 cdouble tmp = mean<cdouble>(in, weights);
221 *realVal = real(tmp);
222 *imagVal = imag(tmp);
223 } break;
224 default: TYPE_ERROR(1, iType);
225 }
226 }
227 CATCHALL;
228 return AF_SUCCESS;
229}

Callers 2

meanFunction · 0.50
af_cdouble meanFunction · 0.50

Calls 3

realFunction · 0.50
imagFunction · 0.50
getTypeMethod · 0.45

Tested by

no test coverage detected