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

Function gaussian1D

src/backend/opencl/kernel/orb.hpp:64–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62
63template<typename T>
64void gaussian1D(T* out, const int dim, double sigma = 0.0) {
65 if (!(sigma > 0)) sigma = 0.25 * dim;
66
67 T sum = (T)0;
68 for (int i = 0; i < dim; i++) {
69 int x = i - (dim - 1) / 2;
70 T el = 1. / sqrt(2 * PI_VAL * sigma * sigma) *
71 exp(-((x * x) / (2 * (sigma * sigma))));
72 out[i] = el;
73 sum += el;
74 }
75
76 for (int k = 0; k < dim; k++) out[k] /= sum;
77}
78
79template<typename T>
80std::array<Kernel, 4> getOrbKernels() {

Callers 1

orbFunction · 0.70

Calls 2

sqrtFunction · 0.85
expFunction · 0.85

Tested by

no test coverage detected