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

Function varAll

src/api/c/var.cpp:57–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template<typename inType, typename outType>
57static outType varAll(const af_array& in, const af_var_bias bias) {
58 using weightType = typename baseOutType<outType>::type;
59 const Array<inType> inArr = getArray<inType>(in);
60 Array<outType> input = cast<outType>(inArr);
61
62 Array<outType> meanCnst = createValueArray<outType>(
63 input.dims(), mean<inType, weightType, outType>(inArr));
64
65 Array<outType> diff =
66 arithOp<outType, af_sub_t>(input, meanCnst, input.dims());
67
68 Array<outType> diffSq = arithOp<outType, af_mul_t>(diff, diff, diff.dims());
69
70 outType result = division(
71 getScalar<outType>(reduce_all<af_add_t, outType, outType>(diffSq)),
72 (input.elements() - (bias == AF_VARIANCE_SAMPLE)));
73
74 return result;
75}
76
77template<typename inType, typename outType>
78static outType varAll(const af_array& in, const af_array weights) {

Callers

nothing calls this directly

Calls 3

divisionFunction · 0.50
dimsMethod · 0.45
elementsMethod · 0.45

Tested by

no test coverage detected