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

Function af_var_weighted

src/api/c/var.cpp:255–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255af_err af_var_weighted(af_array* out, const af_array in, const af_array weights,
256 const dim_t dim) {
257 try {
258 ARG_ASSERT(3, (dim >= 0 && dim <= 3));
259
260 af_array output = 0;
261 const ArrayInfo& iInfo = getInfo(in);
262 const ArrayInfo& wInfo = getInfo(weights);
263 af_dtype iType = iInfo.getType();
264 af_dtype wType = wInfo.getType();
265
266 ARG_ASSERT(
267 2,
268 (wType == f32 ||
269 wType ==
270 f64)); /* verify that weights are non-complex real numbers */
271
272 switch (iType) {
273 case f64:
274 output = var_<double, double>(in, weights,
275 AF_VARIANCE_POPULATION, dim);
276 break;
277 case f32:
278 output = var_<float, float>(in, weights, AF_VARIANCE_POPULATION,
279 dim);
280 break;
281 case s32:
282 output =
283 var_<int, float>(in, weights, AF_VARIANCE_POPULATION, dim);
284 break;
285 case u32:
286 output =
287 var_<uint, float>(in, weights, AF_VARIANCE_POPULATION, dim);
288 break;
289 case s16:
290 output = var_<short, float>(in, weights, AF_VARIANCE_POPULATION,
291 dim);
292 break;
293 case u16:
294 output = var_<ushort, float>(in, weights,
295 AF_VARIANCE_POPULATION, dim);
296 break;
297 case s64:
298 output = var_<intl, double>(in, weights, AF_VARIANCE_POPULATION,
299 dim);
300 break;
301 case u64:
302 output = var_<uintl, double>(in, weights,
303 AF_VARIANCE_POPULATION, dim);
304 break;
305 case s8:
306 output = var_<schar, float>(in, weights, AF_VARIANCE_POPULATION,
307 dim);
308 break;
309 case u8:
310 output = var_<uchar, float>(in, weights, AF_VARIANCE_POPULATION,
311 dim);
312 break;

Callers 1

varFunction · 0.50

Calls 2

swapFunction · 0.85
getTypeMethod · 0.45

Tested by

no test coverage detected