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

Function chi2_statistic

test/rng_quality.cpp:62–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61template<typename T>
62double chi2_statistic(array input, array expected, bool print = false) {
63 expected *= sum<T>(input) / sum<T>(expected);
64 array diff = input - expected;
65
66 double chi2 = sum<T>((diff * diff) / expected);
67 if (print) {
68 array legend = af::seq(input.elements());
69 legend -= (input.elements() / 2.);
70 legend *= (14. / input.elements());
71
72 af_print(
73 join(1, legend, expected.as(f32), input.as(f32), diff.as(f32)));
74 }
75
76 return chi2;
77}
78
79template<>
80double chi2_statistic<half_float::half>(array input, array expected,

Callers

nothing calls this directly

Calls 4

seqClass · 0.85
asMethod · 0.80
joinFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected