Displaying 2 results from an estimated 2 matches for "isdupl".
Did you mean:
isdup
2008 Aug 16
1
unique.default problem (PR#12551)
...ear developers,
The following line of code (produced by a mistake) caused an infinite loop
unique("a",c("a","b"))
or also
unique(1,1:2)
I made a little investigation, and it seems to be that the following function
from unique.c is looping infinitely
static int isDuplicated(SEXP x, int indx, HashData *d)
{
int i, *h;
h = INTEGER(d->HashTable);
i = d->hash(x, indx, d);
while (h[i] != NIL) {
if (d->equal(x, h[i], x, indx))
return h[i] >= 0 ? 1 : 0;
i = (i + 1) % d->M;
}
h[i] = indx;
return 0;
}
In this case h c...
2009 May 08
1
anyDuplicated(incomp=NA) fails
...x: unique.c
===================================================================
--- unique.c (revision 48503)
+++ unique.c (working copy)
@@ -462,16 +462,18 @@
for (i = 0; i < data.M; i++) h[i] = NIL;
if(from_last)
for (i = n-1; i >= 0; i--) {
-#define IS_DUPLICATED_CHECK
- if(isDuplicated(x, i, &data)) {
- Rboolean isDup = TRUE;
- for(j = 0; j < m; j++)
- if(data.equal(x, i, incomp, j)) {
- isDup = FALSE; break;
- }
- if(isDup)
- return ++i;
- /* else continue */
+#define IS_DUPLICATED_CHECK \
+ if(isDuplicated(x, i, &data)) { \
+ Rboolean...