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

Function af_stdev_all_v2

src/api/c/stdev.cpp:100–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100af_err af_stdev_all_v2(double* realVal, double* imagVal, const af_array in,
101 const af_var_bias bias) {
102 UNUSED(imagVal); // TODO implement for complex values
103 try {
104 const ArrayInfo& info = getInfo(in);
105 af_dtype type = info.getType();
106 switch (type) {
107 case f64: *realVal = stdev<double, double>(in, bias); break;
108 case f32: *realVal = stdev<float, float>(in, bias); break;
109 case s32: *realVal = stdev<int, float>(in, bias); break;
110 case u32: *realVal = stdev<uint, float>(in, bias); break;
111 case s16: *realVal = stdev<short, float>(in, bias); break;
112 case u16: *realVal = stdev<ushort, float>(in, bias); break;
113 case s64: *realVal = stdev<intl, double>(in, bias); break;
114 case u64: *realVal = stdev<uintl, double>(in, bias); break;
115 case s8: *realVal = stdev<schar, float>(in, bias); break;
116 case u8: *realVal = stdev<uchar, float>(in, bias); break;
117 case b8: *realVal = stdev<char, float>(in, bias); break;
118 // TODO(umar): FIXME: sqrt(complex) is not present in cuda/opencl
119 // backend case c32: {
120 // cfloat tmp = stdev<cfloat,cfloat>(in);
121 // *realVal = real(tmp);
122 // *imagVal = imag(tmp);
123 // } break;
124 // case c64: {
125 // cdouble tmp = stdev<cdouble,cdouble>(in);
126 // *realVal = real(tmp);
127 // *imagVal = imag(tmp);
128 // } break;
129 default: TYPE_ERROR(1, type);
130 }
131 }
132 CATCHALL;
133 return AF_SUCCESS;
134}
135
136af_err af_stdev(af_array* out, const af_array in, const dim_t dim) {
137 return af_stdev_v2(out, in, AF_VARIANCE_POPULATION, dim);

Callers 3

af_stdev_allFunction · 0.70
stdevFunction · 0.50
af_cdouble stdevFunction · 0.50

Calls 1

getTypeMethod · 0.45

Tested by

no test coverage detected