GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
geary.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <math.h>
3
4
5
double
*
geary_test
(
double
*x,
int
n)
6
{
7
int
i;
8
static
double
y
[2];
9
double
diff,
s
= 0.0, mean = 0.0;
10
11
y[0] = 0.0;
12
for
(i = 0; i < n; ++i)
13
mean += x[i];
14
15
mean /= n;
16
17
for
(i = 0; i < n; ++i) {
18
diff = x[i] - mean;
19
y[0] += fabs(diff);
20
s += diff * diff;
21
}
22
23
s *= n;
24
y[0] /= sqrt(s);
25
y[1] = (y[0] - 0.7979) * sqrt((
double
)n) / 0.2123;
26
27
#ifdef NOISY
28
fprintf(stdout,
" TEST2 GTN =%10.4f Z(GTN) =%10.4f\n"
, y[0], y[1]);
29
#endif
/* NOISY */
30
31
return
y
;
32
}
lib
cdhc
geary.c
Generated on Thu Sep 26 2013 09:48:01 for GRASS Programmer's Manual by
1.8.4