Package rdkit :: Package DataStructs :: Module cDataStructs :: Class SparseBitVect
[hide private]
[frames] | no frames]

Class SparseBitVect

 object --+    
          |    
??.instance --+
              |
             SparseBitVect

A class to store sparse bit vectors.

This class is most useful for situations where the size of the vector
is large and relatively few bits are set

For smaller or denser vectors, the _ExplicitBitVect_ class is much faster.

As you would expect, _SparseBitVects_ support a set of binary operations
so you can do things like:
  bv3 = bv1 & bv2  (bitwise and)
  bv3 = bv1 | bv2  (bitwise or)
  bv3 = bv1 ^ bv2  (bitwise xor)
  bv3 = ~bv1       (bitwise negation) NOTE: this operation is likely
                    to be VERY slow and inefficient.

Bits can be set and read using either the Set/UnsetBit() and GetBit() methods
or by indexing (i.e. bv[i] = 1 or if bv[i]).

Instance Methods [hide private]
 
FromBase64(...)
FromBase64( (SparseBitVect)arg1, (str)arg2) -> None : Initializes the vector from a base64 encoded binary string.
 
GetBit(...)
GetBit( (SparseBitVect)arg1, (int)arg2) -> bool : Returns the value of a bit.
 
GetNumBits(...)
GetNumBits( (SparseBitVect)arg1) -> int : Returns the number of bits in the vector (the vector's size).
 
GetNumOffBits(...)
GetNumOffBits( (SparseBitVect)arg1) -> int : Returns the number of off bits.
 
GetNumOnBits(...)
GetNumOnBits( (SparseBitVect)arg1) -> int : Returns the number of on bits.
 
GetOnBits(...)
GetOnBits( (SparseBitVect)arg1) -> _vecti : Returns a tuple containing IDs of the on bits.
 
SetBit(...)
SetBit( (SparseBitVect)arg1, (int)arg2) -> bool : Turns on a particular bit.
 
SetBitsFromList(...)
SetBitsFromList( (SparseBitVect)arg1, (AtomPairsParameters)arg2) -> None : Turns on a set of bits.
 
ToBase64(...)
ToBase64( (SparseBitVect)arg1) -> str : Converts the vector to a base64 string (the base64 encoded version of the results of ToString()).
 
ToBinary(...)
ToBinary( (SparseBitVect)arg1) -> object : Returns an internal binary representation of the vector.
 
ToBitString(...)
BitVectToText( (SparseBitVect)arg1) -> str :
 
UnSetBit(...)
UnSetBit( (SparseBitVect)arg1, (int)arg2) -> bool : Turns off a particular bit.
 
UnSetBitsFromList(...)
UnSetBitsFromList( (SparseBitVect)arg1, (AtomPairsParameters)arg2) -> None : Turns off a set of bits.
 
__and__(...)
__and__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :
 
__eq__(...)
__eq__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :
 
__getinitargs__(...)
__getinitargs__( (SparseBitVect)arg1) -> tuple :
 
__getitem__(...)
__getitem__( (SparseBitVect)arg1, (int)arg2) -> int :
 
__init__(...)
__init__( (object)arg1, (int)arg2) -> None :
 
__invert__(...)
__invert__( (SparseBitVect)arg1) -> object :
 
__len__(...)
__len__( (SparseBitVect)arg1) -> int :
 
__ne__(...)
__ne__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :
 
__or__(...)
__or__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :
 
__reduce__(...)
helper for pickle
 
__setitem__(...)
__setitem__( (SparseBitVect)arg1, (int)arg2, (int)arg3) -> int :
 
__xor__(...)
__xor__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __instance_size__ = 40
  __safe_for_unpickling__ = True
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

FromBase64(...)

 

FromBase64( (SparseBitVect)arg1, (str)arg2) -> None :
    Initializes the vector from a base64 encoded binary string.
    

    C++ signature :
        void FromBase64(SparseBitVect {lvalue},std::string)

GetBit(...)

 

GetBit( (SparseBitVect)arg1, (int)arg2) -> bool :
    Returns the value of a bit.
    

    C++ signature :
        bool GetBit(SparseBitVect {lvalue},unsigned int)

GetNumBits(...)

 

GetNumBits( (SparseBitVect)arg1) -> int :
    Returns the number of bits in the vector (the vector's size).
    

    C++ signature :
        unsigned int GetNumBits(SparseBitVect {lvalue})

GetNumOffBits(...)

 

GetNumOffBits( (SparseBitVect)arg1) -> int :
    Returns the number of off bits.
    

    C++ signature :
        unsigned int GetNumOffBits(SparseBitVect {lvalue})

GetNumOnBits(...)

 

GetNumOnBits( (SparseBitVect)arg1) -> int :
    Returns the number of on bits.
    

    C++ signature :
        unsigned int GetNumOnBits(SparseBitVect {lvalue})

GetOnBits(...)

 

GetOnBits( (SparseBitVect)arg1) -> _vecti :
    Returns a tuple containing IDs of the on bits.
    

    C++ signature :
        std::vector<int, std::allocator<int> > GetOnBits(SparseBitVect)

SetBit(...)

 

SetBit( (SparseBitVect)arg1, (int)arg2) -> bool :
    Turns on a particular bit.  Returns the original state of the bit.
    

    C++ signature :
        bool SetBit(SparseBitVect {lvalue},unsigned int)

SetBitsFromList(...)

 

SetBitsFromList( (SparseBitVect)arg1, (AtomPairsParameters)arg2) -> None :
    Turns on a set of bits.  The argument should be a tuple or list of bit ids.
    

    C++ signature :
        void SetBitsFromList(SparseBitVect*,boost::python::api::object)

ToBase64(...)

 

ToBase64( (SparseBitVect)arg1) -> str :
    Converts the vector to a base64 string (the base64 encoded version of the results of ToString()).
    

    C++ signature :
        std::string ToBase64(SparseBitVect {lvalue})

ToBinary(...)

 

ToBinary( (SparseBitVect)arg1) -> object :
    Returns an internal binary representation of the vector.
    

    C++ signature :
        boost::python::api::object ToBinary(SparseBitVect)

ToBitString(...)

 

BitVectToText( (SparseBitVect)arg1) -> str :

    C++ signature :
        std::string BitVectToText(SparseBitVect)

BitVectToText( (ExplicitBitVect)arg1) -> str :
    Returns a string of zeros and ones representing the bit vector.

    C++ signature :
        std::string BitVectToText(ExplicitBitVect)

UnSetBit(...)

 

UnSetBit( (SparseBitVect)arg1, (int)arg2) -> bool :
    Turns off a particular bit.  Returns the original state of the bit.
    

    C++ signature :
        bool UnSetBit(SparseBitVect {lvalue},unsigned int)

UnSetBitsFromList(...)

 

UnSetBitsFromList( (SparseBitVect)arg1, (AtomPairsParameters)arg2) -> None :
    Turns off a set of bits.  The argument should be a tuple or list of bit ids.
    

    C++ signature :
        void UnSetBitsFromList(SparseBitVect*,boost::python::api::object)

__and__(...)
(And operator)

 

__and__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :

    C++ signature :
        _object* __and__(SparseBitVect {lvalue},SparseBitVect)

__eq__(...)
(Equality operator)

 

__eq__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :

    C++ signature :
        _object* __eq__(SparseBitVect {lvalue},SparseBitVect)

__getinitargs__(...)

 

__getinitargs__( (SparseBitVect)arg1) -> tuple :

    C++ signature :
        boost::python::tuple __getinitargs__(SparseBitVect)

__getitem__(...)
(Indexing operator)

 

__getitem__( (SparseBitVect)arg1, (int)arg2) -> int :

    C++ signature :
        int __getitem__(SparseBitVect,int)

__init__(...)
(Constructor)

 

__init__( (object)arg1, (int)arg2) -> None :

    C++ signature :
        void __init__(_object*,unsigned int)

__init__( (object)arg1, (str)arg2) -> None :

    C++ signature :
        void __init__(_object*,std::string)

Overrides: object.__init__

__invert__(...)

 

__invert__( (SparseBitVect)arg1) -> object :

    C++ signature :
        _object* __invert__(SparseBitVect {lvalue})

__len__(...)
(Length operator)

 

__len__( (SparseBitVect)arg1) -> int :

    C++ signature :
        unsigned int __len__(SparseBitVect {lvalue})

__ne__(...)

 

__ne__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :

    C++ signature :
        _object* __ne__(SparseBitVect {lvalue},SparseBitVect)

__or__(...)
(Or operator)

 

__or__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :

    C++ signature :
        _object* __or__(SparseBitVect {lvalue},SparseBitVect)

__reduce__(...)

 
helper for pickle

Overrides: object.__reduce__
(inherited documentation)

__setitem__(...)
(Index assignment operator)

 

__setitem__( (SparseBitVect)arg1, (int)arg2, (int)arg3) -> int :

    C++ signature :
        int __setitem__(SparseBitVect {lvalue},int,int)

__xor__(...)
(Exclusive-Or operator)

 

__xor__( (SparseBitVect)arg1, (SparseBitVect)arg2) -> object :

    C++ signature :
        _object* __xor__(SparseBitVect {lvalue},SparseBitVect)