GRASS 8 Programmer's Manual
8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
weisberg.c
Go to the documentation of this file.
1
#include <
stdio.h
>
2
#include <
stdlib.h
>
3
#include <math.h>
4
#include "local_proto.h"
5
6
double
*
Cdhc_weisberg_bingham
(
double
*x,
int
n)
7
{
8
static
double
y[2];
9
double
suma
= 0.0,
sumb
= 0.0,
sumc
= 0.0,
sumd
= 0.0, z, *
xcopy
;
10
int
i;
11
12
if
((
xcopy
= (
double
*)
malloc
(n *
sizeof
(
double
))) ==
NULL
) {
13
fprintf
(
stderr
,
"Memory error in Cdhc_shapiro_francia\n"
);
14
exit
(
EXIT_FAILURE
);
15
}
16
17
for
(i = 0; i < n; ++i)
18
xcopy
[i] =
x
[i];
19
20
qsort
(
xcopy
, n,
sizeof
(
double
),
Cdhc_dcmp
);
21
22
for
(i = 0; i < n; ++i) {
23
z =
Cdhc_xinormal
((i + 1 - 0.375) / (n + 0.25));
24
suma
+= z *
xcopy
[i];
25
sumb
+= z * z;
26
sumc
+=
xcopy
[i];
27
sumd
+=
xcopy
[i] *
xcopy
[i];
28
}
29
30
y[0] =
suma
*
suma
/
sumb
/ (
sumd
-
sumc
*
sumc
/ n);
31
32
#ifdef NOISY
33
fprintf
(
stdout
,
" TEST14 SF(N) =%10.4f\n"
, y[0]);
34
#endif
/* NOISY */
35
36
free
(
xcopy
);
37
38
return
y;
39
}
/* test14_ */
NULL
#define NULL
Definition
ccmath.h:32
AMI_STREAM
Definition
ami_stream.h:153
Cdhc_dcmp
int Cdhc_dcmp(const void *i, const void *j)
Definition
dcmp.c:1
Cdhc_xinormal
double Cdhc_xinormal(double)
Definition
xinormal.c:4
malloc
void * malloc(unsigned)
free
void free(void *)
stdio.h
stdlib.h
Cdhc_weisberg_bingham
double * Cdhc_weisberg_bingham(double *x, int n)
Definition
weisberg.c:6
x
#define x
lib
cdhc
weisberg.c
Generated on Fri Apr 3 2026 06:59:52 for GRASS 8 Programmer's Manual by
1.9.8