Loading...
Searching...
No Matches
c_divr.c
Go to the documentation of this file.
#include <grass/gis.h>
#include <grass/stats.h>
void c_divr(DCELL *result, DCELL *values, int n, const void *closure G_UNUSED)
{
int count;
DCELL prev;
int i;
/* sort the array of values, then count differences */
n = sort_cell(values, n);
if (n == 0) {
*result = 0;
return;
}
count = 1;
prev = values[0];
for (i = 0; i < n; i++)
if (values[i] != prev) {
prev = values[i];
count++;
}
*result = (DCELL)count;
}
c_divr
void c_divr(DCELL *result, DCELL *values, int n, const void *closure)
Definition c_divr.c:4
count
int count
sort_cell
int sort_cell(DCELL *array, int n)
Definition sort_cell.c:27