![]() |
RDKit
Open-source cheminformatics and machine learning.
|
A class to represent vectors of numbers. More...
#include <Vector.h>
Public Types | |
| typedef std::shared_ptr< TYPE[]> | DATA_SPTR |
Public Member Functions | |
| constexpr | Vector (unsigned int N) |
| Initialize with only a size. | |
| constexpr | Vector (unsigned int N, TYPE val) |
| Initialize with a size and default value. | |
| constexpr | Vector (unsigned int N, DATA_SPTR data) |
| Initialize from a smart pointer. | |
| constexpr | Vector (const Vector &other) |
| copy constructor | |
| constexpr | ~Vector ()=default |
| constexpr unsigned int | size () const |
| return the size (dimension) of the vector | |
| TYPE | getVal (unsigned int i) const |
| returns the value at a particular index | |
| void | setVal (unsigned int i, TYPE val) |
| sets the index at a particular value | |
| TYPE | operator[] (unsigned int i) const |
| TYPE & | operator[] (unsigned int i) |
| constexpr TYPE * | getData () |
| returns a pointer to our data array | |
| constexpr const TYPE * | getData () const |
| returns a const pointer to our data array | |
| Vector< TYPE > & | assign (const Vector< TYPE > &other) |
| Copy operator. | |
| Vector< TYPE > & | operator+= (const Vector< TYPE > &other) |
| elementwise addition, vectors must be the same size. | |
| Vector< TYPE > & | operator-= (const Vector< TYPE > &other) |
| elementwise subtraction, vectors must be the same size. | |
| constexpr Vector< TYPE > & | operator*= (TYPE scale) |
| multiplication by a scalar | |
| constexpr Vector< TYPE > & | operator/= (TYPE scale) |
| division by a scalar | |
| constexpr TYPE | normL2Sq () const |
| L2 norm squared. | |
| constexpr TYPE | normL2 () const |
| L2 norm. | |
| constexpr TYPE | normL1 () const |
| L1 norm. | |
| constexpr TYPE | normLinfinity () const |
| L-infinity norm. | |
| constexpr unsigned int | largestAbsValId () const |
| Gets the ID of the entry that has the largest absolute value i.e. the entry being used for the L-infinity norm. | |
| constexpr unsigned int | largestValId () const |
| Gets the ID of the entry that has the largest value. | |
| constexpr unsigned int | smallestValId () const |
| Gets the ID of the entry that has the smallest value. | |
| TYPE | dotProduct (const Vector< TYPE > other) const |
| returns the dot product between two Vectors | |
| constexpr void | normalize () |
| Normalize the vector using the L2 norm. | |
| void | setToRandom (unsigned int seed=0) |
| Set to a random unit vector. | |
A class to represent vectors of numbers.
| typedef std::shared_ptr<TYPE[]> RDNumeric::Vector< TYPE >::DATA_SPTR |
|
inlineexplicitconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
constexprdefault |
|
inline |
|
inline |
returns the dot product between two Vectors
Definition at line 244 of file Vector.h.
Referenced by RDNumeric::TanimotoSimilarity().
|
inlineconstexpr |
returns a pointer to our data array
Definition at line 100 of file Vector.h.
Referenced by RDNumeric::Vector< double >::assign(), RDNumeric::Vector< double >::dotProduct(), RDNumeric::Matrix< double >::getCol(), RDNumeric::SymmMatrix< double >::getCol(), RDNumeric::Matrix< double >::getRow(), RDNumeric::SymmMatrix< double >::getRow(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::Vector< double >::operator+=(), RDNumeric::Vector< double >::operator-=(), and RDNumeric::Vector< double >::Vector().
|
inlineconstexpr |
|
inline |
returns the value at a particular index
Definition at line 78 of file Vector.h.
Referenced by operator<<().
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Normalize the vector using the L2 norm.
Definition at line 258 of file Vector.h.
Referenced by RDNumeric::Vector< double >::setToRandom().
|
inlineconstexpr |
|
inlineconstexpr |
L2 norm.
Definition at line 174 of file Vector.h.
Referenced by RDNumeric::Vector< double >::normalize().
|
inlineconstexpr |
L2 norm squared.
Definition at line 163 of file Vector.h.
Referenced by RDNumeric::Vector< double >::normL2(), and RDNumeric::TanimotoSimilarity().
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
return the size (dimension) of the vector
Definition at line 75 of file Vector.h.
Referenced by RDNumeric::Vector< double >::assign(), RDNumeric::Vector< double >::dotProduct(), RDNumeric::Matrix< double >::getCol(), RDNumeric::SymmMatrix< double >::getCol(), RDNumeric::Matrix< double >::getRow(), RDNumeric::SymmMatrix< double >::getRow(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::Vector< double >::operator+=(), RDNumeric::Vector< double >::operator-=(), operator<<(), and RDNumeric::Vector< double >::Vector().
|
inlineconstexpr |