36 #include "divisionStruct.c"
58 static sureInline(
int) popcount(
unsigned int i);
68 static sureInline(
int) popcount(
unsigned int x)
70 unsigned int m1 = 0x55555555;
71 unsigned int m2 = 0x33333333;
72 unsigned int m4 = 0x0f0f0f0f;
74 x = (x & m2) + ((x >> 2) & m2);
75 x = (x + (x >> 4)) & m4;
77 return (x + (x >> 16)) & 0x3f;
91 hoList[i] = newArrayListDef();
92 piList[i] = newArrayListDef();
104 freeArrayList(&(hoList[i]));
105 freeArrayList(&(piList[i]));
118 pushAL(hoList[i], tp);
119 pushAL(piList[i], idx);
120 CHinc(counters, tp, -1);
138 hypocts = newArrayList(1<<
D);
139 pPositions = newArrayListDef();
144 d->
points = (
int*) calloc(piAL,
sizeof(
int));
154 while(j < size(hoList[i]))
156 if(
CHget(counters,
get(hoList[i])[j]) < 0)
159 pushAL(pPositions, tc);
160 tc -=
CHget(counters,
get(hoList[i])[j]);
162 pushAL(hypocts,
get(hoList[i])[j]);
163 CHinc(counters,
get(hoList[i])[j], tc);
167 pushAL(pPositions, tc);
173 d->
points = (
int*) realloc(d->
points, piAL*
sizeof(
int));
178 while(j < size(piList[i]))
180 jj =
CHget(counters,
get(hoList[i])[j]);
181 d->
points[jj] =
get(piList[i])[j];
182 CHinc(counters,
get(hoList[i])[j], 1);
188 j =
get(pPositions)[jj];
192 get(pPositions)[jj] = limit;
194 while(j <
get(pPositions)[jj+1])
208 get(pPositions)[jj] = limit;
227 jj =
get(pPositions)[k];
230 j = dominant(tPS, &(d->
points[jj]),
231 get(pPositions)[k+1] - jj,
250 pushAL(pPositions, limit);
257 while(j < size(hoList[i]))
259 CHzero(counters,
get(hoList[i])[j]);
269 d->
hypocts = splitAL(&hypocts);
271 d->
points = (
int*) realloc(d->
points, limit*
sizeof(
int));
counterHash CHalloc(int n)
void CHzero(counterHash this, int i)
int CHget(counterHash this, int i)
A hash for containing counter values.
#define D
D is the number of dimensions.
void CHinc(counterHash this, int i, int a)
This header implements an arrayList for integers.
This returns iterators for diferent type. WARNING, these objects are singleton, so new overwrites exi...
Simple point interface. Contains simple point manipulation functions.
This struct is public because of splitter. Do not use direct access.
void destroySplitter(void)
void push(int idx, int tp)
A splitter for storing classified points. The splitter is an array that grows dinamically, when all points are inserted they are separeted into classes by sorting. Preferably count sort or hased count sort.
Structure for uniting two sets, without repetition.
division newDivision(point *PS, point *o, point *p)
Point is an array of coordinates, in a struct for simple and fast copy.
void CHfree(counterHash *this)
Less than 1K use array of counters.