13 static int icmp(
const void *aa,
const void *bb)
21 static int fcmp(
const void *aa,
const void *bb)
33 static int dcmp(
const void *aa,
const void *bb)
45 int f_median(
int argc,
const int *argt,
void **args)
55 for (i = 1; i <= argc; i++)
56 if (argt[i] != argt[0])
69 CELL *a1 = &a[(argc - 1) / 2];
70 CELL *a2 = &a[argc / 2];
75 for (j = 0; j < argc && !nv; j++) {
85 qsort(a, argc,
sizeof(
CELL), icmp);
86 res[i] = (*a1 + *a2) / 2;
96 FCELL *a1 = &a[(argc - 1) / 2];
97 FCELL *a2 = &a[argc / 2];
102 for (j = 0; j < argc && !nv; j++) {
112 qsort(a, argc,
sizeof(
FCELL), fcmp);
113 res[i] = (*a1 + *a2) / 2;
120 DCELL *res = args[0];
123 DCELL *a1 = &a[(argc - 1) / 2];
124 DCELL *a2 = &a[argc / 2];
126 for (i = 0; i <
columns; i++) {
129 for (j = 0; j < argc && !nv; j++) {
139 qsort(a, argc,
sizeof(
DCELL), dcmp);
140 res[i] = (*a1 + *a2) / 2;
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.