Loading...
Searching...
No Matches
RDKit::SparseIntVect< IndexType > Class Template Reference

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

`#include <SparseIntVect.h>`

## 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 & | operator= (const SparseIntVect< IndexType > &other)
| ~SparseIntVect ()=default
| destructor (doesn't need to do anything)
int | getVal (IndexType idx) const
| return the value at an index
void | setVal (IndexType idx, int val)
| set the value at an index
int | operator[] (IndexType idx) const
| support indexing using []
IndexType | getLength () const
| returns the length
int | getTotalVal (bool doAbs=false) const
unsigned int | size () const
| returns the length
const StorageType & | getNonzeroElements () 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
SparseIntVect< IndexType > & | operator*= (int v)
SparseIntVect< IndexType > & | operator* (int v)
SparseIntVect< IndexType > & | operator/= (int v)
SparseIntVect< IndexType > & | operator/ (int v)
SparseIntVect< IndexType > & | operator+= (int v)
SparseIntVect< IndexType > & | operator+ (int v)
SparseIntVect< IndexType > & | operator-= (int v)
SparseIntVect< IndexType > & | operator- (int v)
bool | operator== (const SparseIntVect< IndexType > &v2) const
bool | operator!= (const SparseIntVect< IndexType > &v2) const
std::string | toString () const
| returns a binary string representation (pickle)
void | fromString (const std::string &txt)

## Detailed Description

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

a class for efficiently storing sparse vectors of ints

Definition at line 28 of file SparseIntVect.h.

## Member Typedef Documentation

## StorageType

template<typename IndexType>

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

Definition at line 30 of file SparseIntVect.h.

## Constructor & Destructor Documentation

## SparseIntVect() [1/5]

template<typename IndexType>

RDKit::SparseIntVect< IndexType >::SparseIntVect | ( |  | ) |

inline

Definition at line 32 of file SparseIntVect.h.

Referenced by operator!=(), operator&(), operator&=(), operator*(), operator*=(), operator+(), operator+(), operator+=(), operator+=(), operator-(), operator-(), operator-=(), operator-=(), operator/(), operator/=(), operator=(), operator==(), operator|(), operator|=(), and SparseIntVect().

## SparseIntVect() [2/5]

template<typename IndexType>

RDKit::SparseIntVect< IndexType >::SparseIntVect | ( | IndexType | length | ) |

inline

initialize with a particular length

Definition at line 35 of file SparseIntVect.h.

## SparseIntVect() [3/5]

template<typename IndexType>

RDKit::SparseIntVect< IndexType >::SparseIntVect | ( | const SparseIntVect< IndexType > & | other | ) |

inline

Copy constructor.

Definition at line 38 of file SparseIntVect.h.

References SparseIntVect().

## SparseIntVect() [4/5]

template<typename IndexType>

RDKit::SparseIntVect< IndexType >::SparseIntVect | ( | const std::string & | pkl | ) |

inline

constructor from a pickle

Definition at line 45 of file SparseIntVect.h.

## SparseIntVect() [5/5]

template<typename IndexType>

RDKit::SparseIntVect< IndexType >::SparseIntVect | ( | const char * | pkl,
|  | const unsigned int | len )

inline

constructor from a pickle

Definition at line 49 of file SparseIntVect.h.

## ~SparseIntVect()

template<typename IndexType>

RDKit::SparseIntVect< IndexType >::~SparseIntVect | ( |  | ) |

default

destructor (doesn't need to do anything)

## Member Function Documentation

## fromString()

template<typename IndexType>

void RDKit::SparseIntVect< IndexType >::fromString | ( | const std::string & | txt | ) |

inline

Definition at line 358 of file SparseIntVect.h.

## getLength()

template<typename IndexType>

IndexType RDKit::SparseIntVect< IndexType >::getLength | ( |  | ) | const

inline

returns the length

Definition at line 110 of file SparseIntVect.h.

Referenced by size().

## getNonzeroElements()

template<typename IndexType>

const StorageType & RDKit::SparseIntVect< IndexType >::getNonzeroElements | ( |  | ) | const

inline

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

Definition at line 130 of file SparseIntVect.h.

## getTotalVal()

template<typename IndexType>

int RDKit::SparseIntVect< IndexType >::getTotalVal | ( | bool | doAbs = false | ) | const

inline

returns the sum of all the elements in the vect the doAbs argument toggles summing the absolute values of the elements

Definition at line 114 of file SparseIntVect.h.

## getVal()

template<typename IndexType>

int RDKit::SparseIntVect< IndexType >::getVal | ( | IndexType | idx | ) | const

inline

return the value at an index

Definition at line 77 of file SparseIntVect.h.

Referenced by operator[](), and RDKit::updateFromSequence().

## operator!=()

template<typename IndexType>

bool RDKit::SparseIntVect< IndexType >::operator!= | ( | const SparseIntVect< IndexType > & | v2 | ) | const

inline

Definition at line 331 of file SparseIntVect.h.

References SparseIntVect().

## operator&()

template<typename IndexType>

const SparseIntVect< IndexType > RDKit::SparseIntVect< IndexType >::operator& | ( | const SparseIntVect< IndexType > & | other | ) | const

inline

Definition at line 165 of file SparseIntVect.h.

References SparseIntVect().

## operator&=()

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 135 of file SparseIntVect.h.

References SparseIntVect().

## operator*()

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator* | ( | int | v | ) |

inline

Definition at line 284 of file SparseIntVect.h.

References SparseIntVect().

## operator*=()

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator*= | ( | int | v | ) |

inline

Definition at line 276 of file SparseIntVect.h.

References SparseIntVect().

## operator+() [1/2]

template<typename IndexType>

const SparseIntVect< IndexType > RDKit::SparseIntVect< IndexType >::operator+ | ( | const SparseIntVect< IndexType > & | other | ) | const

inline

Definition at line 237 of file SparseIntVect.h.

References SparseIntVect().

## operator+() [2/2]

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator+ | ( | int | v | ) |

inline

Definition at line 308 of file SparseIntVect.h.

References SparseIntVect().

## operator+=() [1/2]

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator+= | ( | const SparseIntVect< IndexType > & | other | ) |

inline

Definition at line 209 of file SparseIntVect.h.

References SparseIntVect().

## operator+=() [2/2]

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator+= | ( | int | v | ) |

inline

Definition at line 300 of file SparseIntVect.h.

References SparseIntVect().

## operator-() [1/2]

template<typename IndexType>

const SparseIntVect< IndexType > RDKit::SparseIntVect< IndexType >::operator- | ( | const SparseIntVect< IndexType > & | other | ) | const

inline

Definition at line 271 of file SparseIntVect.h.

References SparseIntVect().

## operator-() [2/2]

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator- | ( | int | v | ) |

inline

Definition at line 320 of file SparseIntVect.h.

References SparseIntVect().

## operator-=() [1/2]

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator-= | ( | const SparseIntVect< IndexType > & | other | ) |

inline

Definition at line 243 of file SparseIntVect.h.

References SparseIntVect().

## operator-=() [2/2]

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator-= | ( | int | v | ) |

inline

Definition at line 312 of file SparseIntVect.h.

References SparseIntVect().

## operator/()

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator/ | ( | int | v | ) |

inline

Definition at line 296 of file SparseIntVect.h.

References SparseIntVect().

## operator/=()

template<typename IndexType>

SparseIntVect< IndexType > & RDKit::SparseIntVect< IndexType >::operator/= | ( | int | v | ) |

inline

Definition at line 288 of file SparseIntVect.h.

References SparseIntVect().

## operator=()

template<typename IndexType>

SparseIntVect & RDKit::SparseIntVect< IndexType >::operator= | ( | const SparseIntVect< IndexType > & | other | ) |

inline

Definition at line 53 of file SparseIntVect.h.

References SparseIntVect().

## operator==()

template<typename IndexType>

bool RDKit::SparseIntVect< IndexType >::operator== | ( | const SparseIntVect< IndexType > & | v2 | ) | const

inline

Definition at line 325 of file SparseIntVect.h.

References SparseIntVect().

## operator[]()

template<typename IndexType>

int RDKit::SparseIntVect< IndexType >::operator[] | ( | IndexType | idx | ) | const

inline

support indexing using []

Definition at line 107 of file SparseIntVect.h.

References getVal().

## operator|()

template<typename IndexType>

const SparseIntVect< IndexType > RDKit::SparseIntVect< IndexType >::operator| | ( | const SparseIntVect< IndexType > & | other | ) | const

inline

Definition at line 203 of file SparseIntVect.h.

References SparseIntVect().

## operator|=()

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 174 of file SparseIntVect.h.

References SparseIntVect().

## setVal()

template<typename IndexType>

void RDKit::SparseIntVect< IndexType >::setVal | ( | IndexType | idx,
|  | int | val )

inline

set the value at an index

Definition at line 90 of file SparseIntVect.h.

Referenced by RDKit::updateFromSequence().

## size()

template<typename IndexType>

unsigned int RDKit::SparseIntVect< IndexType >::size | ( |  | ) | const

inline

returns the length

Definition at line 127 of file SparseIntVect.h.

References getLength().

## toString()

template<typename IndexType>

std::string RDKit::SparseIntVect< IndexType >::toString | ( |  | ) | const

inline

returns a binary string representation (pickle)

Definition at line 336 of file SparseIntVect.h.

References ci_SPARSEINTVECT_VERSION, and RDKit::streamWrite().

The documentation for this class was generated from the following file:

- SparseIntVect.h