RDKit
Open-source cheminformatics and machine learning.
|
a class for bit vectors that are sparsely occupied. More...
#include <SparseBitVect.h>
Public Member Functions | |
SparseBitVect () | |
SparseBitVect (unsigned int size) | |
initialize with a particular size; | |
SparseBitVect (const SparseBitVect &other) | |
copy constructor | |
SparseBitVect (const std::string &pkl) | |
construct from a string pickle | |
SparseBitVect (const char *data, const unsigned int dataLen) | |
construct from a text pickle | |
SparseBitVect & | operator= (const SparseBitVect &) |
~SparseBitVect () override | |
bool | operator[] (const unsigned int which) const override |
SparseBitVect | operator| (const SparseBitVect &) const |
SparseBitVect | operator& (const SparseBitVect &) const |
SparseBitVect | operator^ (const SparseBitVect &) const |
SparseBitVect | operator~ () const |
const IntSet * | getBitSet () const |
returns a (const) pointer to our raw storage | |
unsigned int | getNumBits () const override |
returns the number of bits (the length of the BitVect) | |
bool | setBit (const unsigned int which) override |
sets a particular bit and returns its original value | |
bool | setBit (const IntSetIter which) |
bool | unsetBit (const unsigned int which) override |
unsets a particular bit and returns its original value | |
bool | getBit (const unsigned int which) const override |
returns the value of a particular bit | |
bool | getBit (const IntVectIter which) const |
bool | getBit (const IntSetIter which) const |
unsigned int | getNumOnBits () const override |
returns the number of on bits | |
unsigned int | getNumOffBits () const override |
returns the number of off bits | |
std::string | toString () const override |
returns a serialized (pickled) version of this BitVect | |
void | getOnBits (IntVect &v) const override |
replaces the contents of v with indices of our on bits | |
void | clearBits () override |
clears (sets to off) all of our bits | |
bool | operator== (const SparseBitVect &o) const |
bool | operator!= (const SparseBitVect &o) const |
Public Member Functions inherited from BitVect | |
virtual | ~BitVect ()=0 |
void | initFromText (const char *data, const unsigned int dataLen, bool isBase64=false, bool allowOldFormat=false) |
initializes this BitVect from a pickle | |
unsigned int | size () const |
Public Attributes | |
IntSet * | dp_bits |
our raw data, exposed for the sake of efficiency | |
a class for bit vectors that are sparsely occupied.
SparseBitVect objects store only their on bits, in an std::set.
They are, as you might expect, quite memory efficient for sparsely populated vectors but become rather a nightmare if they need to be negated.
Definition at line 35 of file SparseBitVect.h.
|
inline |
Definition at line 37 of file SparseBitVect.h.
|
inlineexplicit |
initialize with a particular size;
Definition at line 39 of file SparseBitVect.h.
|
inline |
copy constructor
Definition at line 44 of file SparseBitVect.h.
References dp_bits, and getNumBits().
SparseBitVect::SparseBitVect | ( | const std::string & | pkl | ) |
construct from a string pickle
SparseBitVect::SparseBitVect | ( | const char * | data, |
const unsigned int | dataLen | ||
) |
construct from a text pickle
|
inlineoverride |
Definition at line 57 of file SparseBitVect.h.
|
inlineoverridevirtual |
clears (sets to off) all of our bits
Implements BitVect.
Definition at line 86 of file SparseBitVect.h.
bool SparseBitVect::getBit | ( | const IntSetIter | which | ) | const |
bool SparseBitVect::getBit | ( | const IntVectIter | which | ) | const |
|
overridevirtual |
returns the value of a particular bit
Implements BitVect.
|
inline |
returns a (const) pointer to our raw storage
Definition at line 66 of file SparseBitVect.h.
|
inlineoverridevirtual |
returns the number of bits (the length of the BitVect)
Implements BitVect.
Definition at line 68 of file SparseBitVect.h.
Referenced by SparseBitVect().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
overridevirtual |
replaces the contents of v
with indices of our on bits
Implements BitVect.
|
inline |
Definition at line 93 of file SparseBitVect.h.
References dp_bits.
SparseBitVect SparseBitVect::operator& | ( | const SparseBitVect & | ) | const |
SparseBitVect & SparseBitVect::operator= | ( | const SparseBitVect & | ) |
|
inline |
Definition at line 90 of file SparseBitVect.h.
References dp_bits.
|
overridevirtual |
Implements BitVect.
SparseBitVect SparseBitVect::operator^ | ( | const SparseBitVect & | ) | const |
SparseBitVect SparseBitVect::operator| | ( | const SparseBitVect & | ) | const |
SparseBitVect SparseBitVect::operator~ | ( | ) | const |
bool SparseBitVect::setBit | ( | const IntSetIter | which | ) |
|
overridevirtual |
sets a particular bit and returns its original value
Implements BitVect.
|
overridevirtual |
|
overridevirtual |
unsets a particular bit and returns its original value
Implements BitVect.
IntSet* SparseBitVect::dp_bits |
our raw data, exposed for the sake of efficiency
Definition at line 87 of file SparseBitVect.h.
Referenced by operator!=(), operator==(), and SparseBitVect().