RDKit::SparseIntVect< IndexType > Class Template Reference

a class for efficiently storing sparse vectors of ints More...

#include <SparseIntVect.h>

List of all members.

Public Types

typedef std::map
< IndexType, int > 
StorageType

Public Member Functions

 SparseIntVect ()
 SparseIntVect (IndexType length)
 initialize with a particular length
 SparseIntVect (const SparseIntVect< IndexType > &other)
 Copy constructor.
 SparseIntVect (const std::string pkl)
 constructor from a pickle
 SparseIntVect (const char *pkl, const unsigned int len)
 constructor from a pickle
 ~SparseIntVect ()
 destructor (doesn't need to do anything)
int getVal (IndexType idx) const
 return the value at an index
int operator[] (IndexType idx) const
void setVal (IndexType idx, int val)
 set the value at an index
IndexType getLength () const
 returns the length
int getTotalVal () const
 returns the sum of all the elements in the vect
const StorageTypegetNonzeroElements () const
 returns our nonzero elements as a map(IndexType->int)
SparseIntVect
< IndexType > & 
operator &= (const SparseIntVect< IndexType > &other)
const SparseIntVect
< IndexType > 
operator & (const SparseIntVect< IndexType > &other) const
SparseIntVect
< IndexType > & 
operator|= (const SparseIntVect< IndexType > &other)
const SparseIntVect
< IndexType > 
operator| (const SparseIntVect< IndexType > &other) const
SparseIntVect
< IndexType > & 
operator+= (const SparseIntVect< IndexType > &other)
const SparseIntVect
< IndexType > 
operator+ (const SparseIntVect< IndexType > &other) const
SparseIntVect
< IndexType > & 
operator-= (const SparseIntVect< IndexType > &other)
const SparseIntVect
< IndexType > 
operator- (const SparseIntVect< IndexType > &other) const
bool operator== (const SparseIntVect< IndexType > &v2)
bool operator!= (const SparseIntVect< IndexType > &v2)
const std::string toString () const
 returns a binary string representation (pickle)
void fromString (std::string &txt)


Detailed Description

template<typename IndexType>
class RDKit::SparseIntVect< IndexType >

a class for efficiently storing sparse vectors of ints

Definition at line 20 of file SparseIntVect.h.


Member Typedef Documentation

template<typename IndexType>
typedef std::map<IndexType,int> RDKit::SparseIntVect< IndexType >::StorageType

Definition at line 22 of file SparseIntVect.h.


Constructor & Destructor Documentation

template<typename IndexType>
RDKit::SparseIntVect< IndexType >::SparseIntVect (  )  [inline]

Definition at line 24 of file SparseIntVect.h.

template<typename IndexType>
RDKit::SparseIntVect< IndexType >::SparseIntVect ( IndexType  length  )  [inline]

initialize with a particular length

Definition at line 27 of file SparseIntVect.h.

template<typename IndexType>
RDKit::SparseIntVect< IndexType >::SparseIntVect ( const SparseIntVect< IndexType > &  other  )  [inline]

Copy constructor.

Definition at line 30 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::d_data, and RDKit::SparseIntVect< IndexType >::d_length.

template<typename IndexType>
RDKit::SparseIntVect< IndexType >::SparseIntVect ( const std::string  pkl  )  [inline]

constructor from a pickle

Definition at line 36 of file SparseIntVect.h.

template<typename IndexType>
RDKit::SparseIntVect< IndexType >::SparseIntVect ( const char *  pkl,
const unsigned int  len 
) [inline]

constructor from a pickle

Definition at line 40 of file SparseIntVect.h.

template<typename IndexType>
RDKit::SparseIntVect< IndexType >::~SparseIntVect (  )  [inline]

destructor (doesn't need to do anything)

Definition at line 45 of file SparseIntVect.h.


Member Function Documentation

template<typename IndexType>
int RDKit::SparseIntVect< IndexType >::getVal ( IndexType  idx  )  const [inline]

return the value at an index

Definition at line 48 of file SparseIntVect.h.

Referenced by RDKit::SparseIntVect< IndexType >::operator[](), and RDKit::updateFromSequence().

template<typename IndexType>
int RDKit::SparseIntVect< IndexType >::operator[] ( IndexType  idx  )  const [inline]

Definition at line 59 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::getVal().

template<typename IndexType>
void RDKit::SparseIntVect< IndexType >::setVal ( IndexType  idx,
int  val 
) [inline]

set the value at an index

Definition at line 62 of file SparseIntVect.h.

Referenced by RDKit::updateFromSequence().

template<typename IndexType>
IndexType RDKit::SparseIntVect< IndexType >::getLength (  )  const [inline]

returns the length

Definition at line 73 of file SparseIntVect.h.

Referenced by RDKit::DiceSimilarity().

template<typename IndexType>
int RDKit::SparseIntVect< IndexType >::getTotalVal (  )  const [inline]

returns the sum of all the elements in the vect

Definition at line 76 of file SparseIntVect.h.

Referenced by RDKit::DiceSimilarity().

template<typename IndexType>
const StorageType& RDKit::SparseIntVect< IndexType >::getNonzeroElements (  )  const [inline]

returns our nonzero elements as a map(IndexType->int)

Definition at line 87 of file SparseIntVect.h.

Referenced by RDKit::DiceSimilarity().

template<typename IndexType>
SparseIntVect<IndexType>& RDKit::SparseIntVect< IndexType >::operator &= ( const SparseIntVect< IndexType > &  other  )  [inline]

this is a "fuzzy" intesection, the final value of each element is equal to the minimum from the two vects.

Definition at line 96 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::d_data, and RDKit::SparseIntVect< IndexType >::d_length.

template<typename IndexType>
const SparseIntVect<IndexType> RDKit::SparseIntVect< IndexType >::operator & ( const SparseIntVect< IndexType > &  other  )  const [inline]

Definition at line 127 of file SparseIntVect.h.

template<typename IndexType>
SparseIntVect<IndexType>& RDKit::SparseIntVect< IndexType >::operator|= ( const SparseIntVect< IndexType > &  other  )  [inline]

this is a "fuzzy" union, the final value of each element is equal to the maximum from the two vects.

Definition at line 136 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::d_data, and RDKit::SparseIntVect< IndexType >::d_length.

template<typename IndexType>
const SparseIntVect<IndexType> RDKit::SparseIntVect< IndexType >::operator| ( const SparseIntVect< IndexType > &  other  )  const [inline]

Definition at line 167 of file SparseIntVect.h.

template<typename IndexType>
SparseIntVect<IndexType>& RDKit::SparseIntVect< IndexType >::operator+= ( const SparseIntVect< IndexType > &  other  )  [inline]

Definition at line 173 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::d_data, and RDKit::SparseIntVect< IndexType >::d_length.

template<typename IndexType>
const SparseIntVect<IndexType> RDKit::SparseIntVect< IndexType >::operator+ ( const SparseIntVect< IndexType > &  other  )  const [inline]

Definition at line 203 of file SparseIntVect.h.

template<typename IndexType>
SparseIntVect<IndexType>& RDKit::SparseIntVect< IndexType >::operator-= ( const SparseIntVect< IndexType > &  other  )  [inline]

Definition at line 209 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::d_data, and RDKit::SparseIntVect< IndexType >::d_length.

template<typename IndexType>
const SparseIntVect<IndexType> RDKit::SparseIntVect< IndexType >::operator- ( const SparseIntVect< IndexType > &  other  )  const [inline]

Definition at line 239 of file SparseIntVect.h.

template<typename IndexType>
bool RDKit::SparseIntVect< IndexType >::operator== ( const SparseIntVect< IndexType > &  v2  )  [inline]

Definition at line 244 of file SparseIntVect.h.

References RDKit::SparseIntVect< IndexType >::d_data, and RDKit::SparseIntVect< IndexType >::d_length.

template<typename IndexType>
bool RDKit::SparseIntVect< IndexType >::operator!= ( const SparseIntVect< IndexType > &  v2  )  [inline]

Definition at line 250 of file SparseIntVect.h.

template<typename IndexType>
const std::string RDKit::SparseIntVect< IndexType >::toString (  )  const [inline]

returns a binary string representation (pickle)

Definition at line 255 of file SparseIntVect.h.

References ci_SPARSEINTVECT_VERSION.

template<typename IndexType>
void RDKit::SparseIntVect< IndexType >::fromString ( std::string &  txt  )  [inline]

Definition at line 273 of file SparseIntVect.h.


The documentation for this class was generated from the following file:
Generated on Sat May 24 08:36:34 2008 for RDCode by  doxygen 1.5.3