2 #include <grass/arraystats.h>
9 double sum = 0, sumsq = 0, sumabs = 0;
10 double dev = 0, dev2 = 0;
14 stats->max = data[count - 1];
16 for (i = 0; i <
count; i++) {
18 sumabs += fabs(data[i]);
19 sumsq += data[i] * data[i];
22 stats->sumabs = sumabs;
25 stats->mean = stats->sum / stats->count;
26 stats->meanabs = stats->sumabs / stats->count;
27 for (i = 0; i <
count; i++) {
28 dev2 = dev2 + (data[i] - stats->mean) * (data[i] - stats->mean);
29 dev = dev + (data[i] - stats->mean);
33 stats->var = (dev2 - (dev * dev / stats->count)) / stats->count;
34 stats->stdev = sqrt(stats->var);
40 void eqdrt(
double vectx[],
double vecty[],
int i1,
int i2,
double *vabc)
42 double bn = 0, bd = 0, x1 = 0, y1 = 0;
59 vabc[0] = y1 - vabc[1] * x1;
65 G_debug(3,
"Points are equal\n");
void eqdrt(double vectx[], double vecty[], int i1, int i2, double *vabc)
void basic_stats(double *data, int count, struct GASTATS *stats)
int G_debug(int level, const char *msg,...)
Print debugging message.