Hi everyone, 

As the title says, the == function appears to give strange and misleading 
information about Arrays of IntSets.
In particular, a copy (or deep copy) of the array is NOT identical to the 
original intset array, according to the == function.
However, according to the setdiff() function, the copy succeeded, as 
expected.    This result seems especially strange
and mysterious because it hones in on a seemingly random location (the 
third element) of the IntSet.   Reproducible code below.


##### Make an Array of Int Sets.
#Here there are N_intsets= 4 intsets
#Each intset contains the set of integers which are in between these 
"Pointers"
Pointers=[1,239680,479359,719038,958717]
N_intsets=4

function makeIntSetArray!(IntSetArray,Pointers,N_intsets)
    for s=1:N_intsets
        IntSetArray[s]=IntSet(int(Pointers[s]:(Pointers[s+1]-1)));
  end
end

IntSetArray=IntSet[];
resize!(IntSetArray,N_intsets)
makeIntSetArray!(IntSetArray,Pointers,N_intsets)

##### Three attempts to make a copy all appear to fail. 
#Attempt 1
IntSetArray2=copy(IntSetArray);
#Did It work?  NO
IntSetArray2.==IntSetArray

#Attempt 2
IntSetArray2=deepcopy(IntSetArray);
#Did It work?  NO
IntSetArray2.==IntSetArray

#Attempt 3
IntSetArray2=(IntSetArray);
#Did It work?  NO
IntSetArray2.==IntSetArray

##### However, the setdiff function suggests no difference between these 
two arrays
#in the problematic location (element 3)

setdiff(IntSetArray[3], IntSetArray2[3])



Reply via email to