14 static int icmp(
const void *aa,
const void *bb)
22 static int fcmp(
const void *aa,
const void *bb)
34 static int dcmp(
const void *aa,
const void *bb)
46 int f_median(
int argc,
const int *argt,
void **args)
56 for (i = 1; i <= argc; i++)
57 if (argt[i] != argt[0])
71 CELL *a1 = &a[(argc - 1) / 2];
72 CELL *a2 = &a[argc / 2];
77 for (j = 0; j < argc && !nv; j++) {
87 qsort(a, argc,
sizeof(
CELL), icmp);
88 res[i] = (*a1 + *a2) / 2;
99 FCELL *a1 = &a[(argc - 1) / 2];
100 FCELL *a2 = &a[argc / 2];
102 for (i = 0; i <
columns; i++) {
105 for (j = 0; j < argc && !nv; j++) {
115 qsort(a, argc,
sizeof(
FCELL), fcmp);
116 res[i] = (*a1 + *a2) / 2;
124 DCELL *res = args[0];
127 DCELL *a1 = &a[(argc - 1) / 2];
128 DCELL *a2 = &a[argc / 2];
130 for (i = 0; i <
columns; i++) {
133 for (j = 0; j < argc && !nv; j++) {
143 qsort(a, argc,
sizeof(
DCELL), dcmp);
144 res[i] = (*a1 + *a2) / 2;
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.