35 #include "divisionStruct.c"
57 static sureInline(
int) popcount(
unsigned int i);
67 static sureInline(
int) popcount(
unsigned int x)
69 unsigned int m1 = 0x55555555;
70 unsigned int m2 = 0x33333333;
71 unsigned int m4 = 0x0f0f0f0f;
73 x = (x & m2) + ((x >> 2) & m2);
74 x = (x + (x >> 4)) & m4;
76 return (x + (x >> 16)) & 0x3f;
90 hoList[i] = newArrayListDef();
91 piList[i] = newArrayListDef();
103 freeArrayList(&(hoList[i]));
104 freeArrayList(&(piList[i]));
117 pushAL(hoList[i], tp);
118 pushAL(piList[i], idx);
119 CHinc(counters, tp, -1);
137 hypocts = newArrayList(1<<
D);
138 pPositions = newArrayListDef();
143 d->
points = (
int*) calloc(piAL,
sizeof(
int));
153 while(j < size(hoList[i]))
155 if(
CHget(counters,
get(hoList[i])[j]) < 0)
158 pushAL(pPositions, tc);
159 tc -=
CHget(counters,
get(hoList[i])[j]);
161 pushAL(hypocts,
get(hoList[i])[j]);
162 CHinc(counters,
get(hoList[i])[j], tc);
166 pushAL(pPositions, tc);
172 d->
points = (
int*) realloc(d->
points, piAL*
sizeof(
int));
177 while(j < size(piList[i]))
179 jj =
CHget(counters,
get(hoList[i])[j]);
180 d->
points[jj] =
get(piList[i])[j];
181 CHinc(counters,
get(hoList[i])[j], 1);
187 j =
get(pPositions)[jj];
191 get(pPositions)[jj] = limit;
193 while(j <
get(pPositions)[jj+1])
207 get(pPositions)[jj] = limit;
226 jj =
get(pPositions)[k];
229 j = dominant(PS, &(d->
points[jj]),
230 get(pPositions)[k+1] - jj,
249 pushAL(pPositions, limit);
256 while(j < size(hoList[i]))
258 CHzero(counters,
get(hoList[i])[j]);
268 d->
hypocts = splitAL(&hypocts);
270 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.
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.