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

Function gaussian1D

src/backend/opencl/kernel/harris.hpp:34–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template<typename T>
34void gaussian1D(T *out, const int dim, double sigma = 0.0) {
35 if (!(sigma > 0)) sigma = 0.25 * dim;
36
37 T sum = (T)0;
38 for (int i = 0; i < dim; i++) {
39 int x = i - (dim - 1) / 2;
40 T el = 1. / sqrt(2 * af::Pi * sigma * sigma) *
41 exp(-((x * x) / (2 * (sigma * sigma))));
42 out[i] = el;
43 sum += el;
44 }
45
46 for (int k = 0; k < dim; k++) out[k] /= sum;
47}
48
49template<typename T, typename convAccT>
50void conv_helper(Array<T> &ixx, Array<T> &ixy, Array<T> &iyy,

Callers

nothing calls this directly

Calls 2

sqrtFunction · 0.85
expFunction · 0.85

Tested by

no test coverage detected