IntSets right now are somewhat broken for general use.  I've been working 
on revamping them to be better behaved.  Your example passes on my 
work-in-progress IntSets package.  I hope to try to get it merged back into 
base soon.

In this case, the problem isn't with arrays or copy, it's with testing 
equality of particular IntSets. There's a simple fix I'll push later 
tonight.  Simple test-case: IntSet(255) == IntSet(255)


On Monday, February 2, 2015 at 2:31:11 PM UTC-5, Michael Wojnowicz wrote:
>
>
> 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