13 #include <grass/gmath.h>
18 long i, j, totsize,
n, g_row;
19 float rsq, sigma, two_ssq, val, sum = 0.0;
21 totsize = size *
size;
23 for (i = 0; i < totsize; i++) {
28 sigma = w / (2.0 * sqrt((
double)2.0));
29 two_ssq = 2.0 * sigma * sigma;
30 for (i = 0; i <
n; i++) {
32 for (j = 0; j <
n; j++) {
34 val = (rsq / two_ssq - 1) * exp(-rsq / two_ssq);
35 *(g[0] + g_row + j) = val;
39 *(g[0] + g_row + (size - j)) = val;
43 *(g[0] + (size - i) * size + j) = val;
47 *(g[0] + (size - i) * size + (size - j)) = val;
int getg(double w, double *g[2], int size)