in the file lred.c, the function initialize involves 
if(j>=0&&i!=j){
 ...
}

The condition i!=j should be removed. The reason is as follows:

Our map array is required to be injective. But if in our array there exist some entry such that map[i]==i, it will not affect the injection of the map array if there does not exist an integer k such that map[k]==i and k!=i. 

Therefore if in our map array, there is an entry such that map[i]==i. After executing the initialize function, inverseMap[i]==-1.  If we remove i!=j from the conditional of the if statement, inverseMap[i]==i.  If our map is not injective and there is another k such that map[k]==i, it will not cause any failure of the assertions. To be simple, the program cannot detect that the map is not injective if it contains map[i]==i and map[k]==i(i!=k). 


Update: posted by SFSiegel.

I removed the condition i!=j and also modified redistribute as follows:

    } else { /* cycle */
      if (i != k) {
	storeBlocks(lred, j);
	while (i != k) {
	  copyBlocks(lred, j, i);
	  q[j] = -1;
	  j = i;
	  i = q[j];
	}
	loadBlocks(lred, j);
      }
      q[j] = -1;
    }

The reason for adding the check for i!=k is that now it is possible
that i==k, in which case the algorithm is correct but unnecessarily
copies data out of i(=j=k) and then copies it back in with the
storeBlocks/loadBlocks routines.  This is the case of a cycle of
length 1.  The reason I added the condition "i!=j" in the inverse map
in the first place was to avoid that unnecessary copying.  I thought
that since q[j]=-1 indicates that "block j now has the correct new
contents" I could just set it to -1 at the very beginning when q is
being constructed.  The problem was that I am also using the
construction of q to check that the map is injective, and you can't do
both at the same time.    So now it should all work: I check that the
map is really injective, keeping the trivial cycles in q, but when I 
detect a trivial cycle at redistribution time, I just don't do anything,
other than to set q[j] to -1.
