79 #include "allheaders.h" 106 if (pnaindex) *pnaindex = NULL;
108 return (
PTA *)ERROR_PTR(
"ptas not defined", procName, NULL);
110 return (
PTA *)ERROR_PTR(
"invalid sort type", procName, NULL);
112 return (
PTA *)ERROR_PTR(
"invalid sort order", procName, NULL);
115 return (
PTA *)ERROR_PTR(
"naindex not made", procName, NULL);
123 return (
PTA *)ERROR_PTR(
"ptad not made", procName, NULL);
148 PROCNAME(
"ptaGetSortIndex");
151 return ERROR_INT(
"&naindex not defined", procName, 1);
154 return ERROR_INT(
"ptas not defined", procName, 1);
156 return ERROR_INT(
"invalid sort type", procName, 1);
158 return ERROR_INT(
"invalid sort order", procName, 1);
163 return ERROR_INT(
"na not made", procName, 1);
164 for (i = 0; i < n; i++) {
176 return ERROR_INT(
"naindex not made", procName, 1);
196 PROCNAME(
"ptaSortByIndex");
199 return (
PTA *)ERROR_PTR(
"ptas not defined", procName, NULL);
201 return (
PTA *)ERROR_PTR(
"naindex not defined", procName, NULL);
206 return (
PTA *)ERROR_PTR(
"ptad not made", procName, NULL);
207 for (i = 0; i < n; i++) {
232 PROCNAME(
"ptaaSortByIndex");
235 return (
PTAA *)ERROR_PTR(
"ptaas not defined", procName, NULL);
237 return (
PTAA *)ERROR_PTR(
"naindex not defined", procName, NULL);
241 return (
PTAA *)ERROR_PTR(
"numa and ptaa sizes differ", procName, NULL);
243 for (i = 0; i < n; i++) {
273 PROCNAME(
"ptaGetRankValue");
276 return ERROR_INT(
"&val not defined", procName, 1);
279 return ERROR_INT(
"pta not defined", procName, 1);
281 return ERROR_INT(
"invalid sort type", procName, 1);
282 if (fract < 0.0 || fract > 1.0)
283 return ERROR_INT(
"fract not in [0.0 ... 1.0]", procName, 1);
285 return ERROR_INT(
"pta empty", procName, 1);
292 index = (l_int32)(fract * (l_float32)(n - 1) + 0.5);
329 PROCNAME(
"ptaUnionByAset");
332 return (
PTA *)ERROR_PTR(
"pta1 not defined", procName, NULL);
334 return (
PTA *)ERROR_PTR(
"pta2 not defined", procName, NULL);
369 PROCNAME(
"ptaRemoveDupsByAset");
372 return (
PTA *)ERROR_PTR(
"ptas not defined", procName, NULL);
374 set = l_asetCreate(L_UINT_TYPE);
377 for (i = 0; i < n; i++) {
381 if (!l_asetFind(
set, key)) {
383 l_asetInsert(
set, key);
411 l_int32 n1, n2, i, n, x, y;
415 PTA *pta_small, *pta_big, *ptad;
417 PROCNAME(
"ptaIntersectionByAset");
420 return (
PTA *)ERROR_PTR(
"pta1 not defined", procName, NULL);
422 return (
PTA *)ERROR_PTR(
"pta2 not defined", procName, NULL);
427 pta_small = (n1 < n2) ? pta1 : pta2;
428 pta_big = (n1 < n2) ? pta2 : pta1;
434 set2 = l_asetCreate(L_UINT_TYPE);
435 for (i = 0; i < n; i++) {
439 if (l_asetFind(set1, key) && !l_asetFind(set2, key)) {
441 l_asetInsert(set2, key);
445 l_asetDestroy(&set1);
446 l_asetDestroy(&set2);
465 PROCNAME(
"l_asetCreateFromPta");
468 return (
L_ASET *)ERROR_PTR(
"pta not defined", procName, NULL);
470 set = l_asetCreate(L_UINT_TYPE);
472 for (i = 0; i < n; i++) {
476 l_asetInsert(
set, key);
505 PROCNAME(
"ptaUnionByHash");
508 return (
PTA *)ERROR_PTR(
"pta1 not defined", procName, NULL);
510 return (
PTA *)ERROR_PTR(
"pta2 not defined", procName, NULL);
554 l_int32 i, n, index, items, x, y;
560 PROCNAME(
"ptaRemoveDupsByHash");
562 if (pdahash) *pdahash = NULL;
564 return ERROR_INT(
"&ptad not defined", procName, 1);
567 return ERROR_INT(
"ptas not defined", procName, 1);
574 for (i = 0, items = 0; i < n; i++) {
610 l_int32 n1, n2, nsmall, i, x, y, index1, index2;
614 PTA *pta_small, *pta_big, *ptad;
616 PROCNAME(
"ptaIntersectionByHash");
619 return (
PTA *)ERROR_PTR(
"pta1 not defined", procName, NULL);
621 return (
PTA *)ERROR_PTR(
"pta2 not defined", procName, NULL);
626 pta_small = (n1 < n2) ? pta1 : pta2;
627 pta_big = (n1 < n2) ? pta2 : pta1;
637 for (i = 0; i < nsmall; i++) {
687 l_int32 i, nvals, index, xi, yi;
691 PROCNAME(
"ptaFindPtByHash");
694 return ERROR_INT(
"&index not defined", procName, 1);
697 return ERROR_INT(
"pta not defined", procName, 1);
699 return ERROR_INT(
"dahash not defined", procName, 1);
707 for (i = 0; i < nvals; i++) {
710 if (x == xi && y == yi) {
734 PROCNAME(
"l_dnaHashCreateFromPta");
737 return (
L_DNAHASH *)ERROR_PTR(
"pta not defined", procName, NULL);
751 for (i = 0; i < n; i++) {
l_ok l_hashPtToUint64(l_int32 x, l_int32 y, l_uint64 *phash)
l_hashPtToUint64()
l_ok ptaGetRankValue(PTA *pta, l_float32 fract, PTA *ptasort, l_int32 sorttype, l_float32 *pval)
ptaGetRankValue()
L_DNA * l_dnaHashGetDna(L_DNAHASH *dahash, l_uint64 key, l_int32 copyflag)
l_dnaHashGetDna()
NUMA * numaGetSortIndex(NUMA *na, l_int32 sortorder)
numaGetSortIndex()
l_int32 l_dnaGetCount(L_DNA *da)
l_dnaGetCount()
l_ok ptaAddPt(PTA *pta, l_float32 x, l_float32 y)
ptaAddPt()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
void l_dnaHashDestroy(L_DNAHASH **pdahash)
l_dnaHashDestroy()
l_ok ptaFindPtByHash(PTA *pta, L_DNAHASH *dahash, l_int32 x, l_int32 y, l_int32 *pindex)
ptaFindPtByHash()
PTA * ptaCreate(l_int32 n)
ptaCreate()
l_ok l_dnaGetIValue(L_DNA *da, l_int32 index, l_int32 *pival)
l_dnaGetIValue()
l_ok ptaGetSortIndex(PTA *ptas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex)
ptaGetSortIndex()
NUMA * numaCreate(l_int32 n)
numaCreate()
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
l_ok findNextLargerPrime(l_int32 start, l_uint32 *pprime)
findNextLargerPrime()
PTA * ptaSort(PTA *ptas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex)
ptaSort()
PTA * ptaRemoveDupsByAset(PTA *ptas)
ptaRemoveDupsByAset()
l_ok ptaJoin(PTA *ptad, PTA *ptas, l_int32 istart, l_int32 iend)
ptaJoin()
PTAA * ptaaSortByIndex(PTAA *ptaas, NUMA *naindex)
ptaaSortByIndex()
l_ok l_dnaHashAdd(L_DNAHASH *dahash, l_uint64 key, l_float64 value)
l_dnaHashAdd()
PTA * ptaaGetPta(PTAA *ptaa, l_int32 index, l_int32 accessflag)
ptaaGetPta()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
PTA * ptaUnionByAset(PTA *pta1, PTA *pta2)
ptaUnionByAset()
PTA * ptaCopy(PTA *pta)
ptaCopy()
void numaDestroy(NUMA **pna)
numaDestroy()
PTA * ptaIntersectionByHash(PTA *pta1, PTA *pta2)
ptaIntersectionByHash()
PTA * ptaIntersectionByAset(PTA *pta1, PTA *pta2)
ptaIntersectionByAset()
L_ASET * l_asetCreateFromPta(PTA *pta)
l_asetCreateFromPta()
l_ok ptaRemoveDupsByHash(PTA *ptas, PTA **pptad, L_DNAHASH **pdahash)
ptaRemoveDupsByHash()
l_int32 ptaaGetCount(PTAA *ptaa)
ptaaGetCount()
void ptaDestroy(PTA **ppta)
ptaDestroy()
L_DNAHASH * l_dnaHashCreateFromPta(PTA *pta)
l_dnaHashCreateFromPta()
l_ok ptaGetIPt(PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
ptaGetIPt()
l_ok ptaaAddPta(PTAA *ptaa, PTA *pta, l_int32 copyflag)
ptaaAddPta()
L_DNAHASH * l_dnaHashCreate(l_int32 nbuckets, l_int32 initsize)
l_dnaHashCreate()
PTAA * ptaaCreate(l_int32 n)
ptaaCreate()
PTA * ptaSortByIndex(PTA *ptas, NUMA *naindex)
ptaSortByIndex()
PTA * ptaUnionByHash(PTA *pta1, PTA *pta2)
ptaUnionByHash()