# HG changeset patch
# User dcoudert <david.coudert@inria.fr>
# Date 1344352627 7200
# Node ID e0fc3cc2480e4a1df27532dbc6f38e6eb997bd99
# Parent a3a5bdf1e8c8c9f17f141150bf07043c8115ec4b
trac #11353  binds tilde for the complement of FrozenBitset
diff git a/sage/misc/bitset.pxd b/sage/misc/bitset.pxd
a

b


13  13  cpdef intersection(self, FrozenBitset other) 
14  14  cpdef difference(self, FrozenBitset other) 
15  15  cpdef symmetric_difference(self, FrozenBitset other) 
 16  cpdef complement(self) 
16  17  cpdef __copy__(self) 
17  18  
18  19  cdef class Bitset(FrozenBitset): 
diff git a/sage/misc/bitset.pyx b/sage/misc/bitset.pyx
a

b


820  820  """ 
821  821  return self.symmetric_difference(other) 
822  822  
 823  cpdef complement(self): 
 824  """ 
 825  Return the complement of self. 
 826  
 827  EXAMPLES:: 
 828  
 829  sage: ~FrozenBitset('10101') 
 830  01010 
 831  sage: ~FrozenBitset('11111'*10) 
 832  00000000000000000000000000000000000000000000000000 
 833  sage: x = FrozenBitset('10'*40) 
 834  sage: x == ~x 
 835  False 
 836  sage: x == ~~x 
 837  True 
 838  sage: x(~x) == FrozenBitset('11'*40) 
 839  True 
 840  sage: ~x == FrozenBitset('01'*40) 
 841  True 
 842  """ 
 843  cdef FrozenBitset temp = self._new(self._bitset.size) 
 844  bitset_complement(temp._bitset, self._bitset) 
 845  return temp 
 846  
 847  def __invert__(self): 
 848  """ 
 849  Return the complement of self. 
 850  
 851  EXAMPLES:: 
 852  
 853  sage: ~FrozenBitset('10101') 
 854  01010 
 855  sage: ~FrozenBitset('11111'*10) 
 856  00000000000000000000000000000000000000000000000000 
 857  sage: x = FrozenBitset('10'*40) 
 858  sage: x == ~x 
 859  False 
 860  sage: x == ~~x 
 861  True 
 862  sage: x(~x) == FrozenBitset('11'*40) 
 863  True 
 864  sage: ~x == FrozenBitset('01'*40) 
 865  True 
 866  """ 
 867  return self.complement() 
 868  
823  869  cpdef __copy__(self): 
824  870  """ 
825  871  Return self (since self is immutable). 