GRASS 8 Programmer's Manual
8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
shapiroe.c
Go to the documentation of this file.
1
#include <
stdio.h
>
2
#include <math.h>
3
4
double
*
Cdhc_shapiro_wilk_exp
(
double
*x,
int
n)
5
{
6
static
double
y[2];
7
double
mean
,
b
,
s1
,
xs
,
sum1
= 0.0, sum2 = 0.0;
8
int
i;
9
xs
=
x
[0];
10
11
for
(i = 0; i < n; ++i)
12
if
(i == 0 ||
xs
>
x
[i])
13
xs
=
x
[i];
14
15
for
(i = 0; i < n; ++i) {
16
sum1
+=
x
[i];
17
sum2 +=
x
[i] *
x
[i];
18
}
19
20
s1
= sum2 -
sum1
*
sum1
/ n;
21
mean
=
sum1
/ n;
22
b
= (
mean
-
xs
) *
sqrt
((
double
)n / (n - 1.0));
23
y[0] =
b
*
b
/
s1
;
24
25
#ifdef NOISY
26
fprintf
(
stdout
,
" TEST15 SW(E) =%10.4f\n"
, y[0]);
27
#endif
/* NOISY */
28
29
return
y;
30
}
AMI_STREAM
Definition
ami_stream.h:153
mean
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.
Definition
iclass_statistics.c:369
b
double b
Definition
r_raster.c:39
Cdhc_shapiro_wilk_exp
double * Cdhc_shapiro_wilk_exp(double *x, int n)
Definition
shapiroe.c:4
stdio.h
x
#define x
lib
cdhc
shapiroe.c
Generated on Fri Apr 3 2026 06:59:52 for GRASS 8 Programmer's Manual by
1.9.8