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

Function af_var_all_weighted

src/api/c/var.cpp:379–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379af_err af_var_all_weighted(double* realVal, double* imagVal, const af_array in,
380 const af_array weights) {
381 try {
382 const ArrayInfo& iInfo = getInfo(in);
383 const ArrayInfo& wInfo = getInfo(weights);
384 af_dtype iType = iInfo.getType();
385 af_dtype wType = wInfo.getType();
386
387 ARG_ASSERT(
388 3,
389 (wType == f32 ||
390 wType ==
391 f64)); /* verify that weights are non-complex real numbers */
392
393 switch (iType) {
394 case f64: *realVal = varAll<double, double>(in, weights); break;
395 case f32: *realVal = varAll<float, float>(in, weights); break;
396 case s32: *realVal = varAll<int, float>(in, weights); break;
397 case u32: *realVal = varAll<uint, float>(in, weights); break;
398 case s16: *realVal = varAll<short, float>(in, weights); break;
399 case u16: *realVal = varAll<ushort, float>(in, weights); break;
400 case s64: *realVal = varAll<intl, double>(in, weights); break;
401 case u64: *realVal = varAll<uintl, double>(in, weights); break;
402 case s8: *realVal = varAll<schar, float>(in, weights); break;
403 case u8: *realVal = varAll<uchar, float>(in, weights); break;
404 case b8: *realVal = varAll<char, float>(in, weights); break;
405 case f16: *realVal = varAll<half, float>(in, weights); break;
406 case c32: {
407 cfloat tmp = varAll<cfloat, cfloat>(in, weights);
408 *realVal = real(tmp);
409 *imagVal = imag(tmp);
410 } break;
411 case c64: {
412 cdouble tmp = varAll<cdouble, cdouble>(in, weights);
413 *realVal = real(tmp);
414 *imagVal = imag(tmp);
415 } break;
416 default: TYPE_ERROR(1, iType);
417 }
418 }
419 CATCHALL;
420 return AF_SUCCESS;
421}
422
423af_err af_meanvar(af_array* mean, af_array* var, const af_array in,
424 const af_array weights, const af_var_bias bias,

Callers 2

varFunction · 0.50
af_cdouble varFunction · 0.50

Calls 3

realFunction · 0.50
imagFunction · 0.50
getTypeMethod · 0.45

Tested by

no test coverage detected