RDKit
Open-source cheminformatics and machine learning.
|
A class to represent vectors of numbers. More...
#include <Vector.h>
Public Types | |
typedef boost::shared_array< TYPE > | DATA_SPTR |
Public Member Functions | |
Vector (unsigned int N) | |
Initialize with only a size. | |
Vector (unsigned int N, TYPE val) | |
Initialize with a size and default value. | |
Vector (unsigned int N, DATA_SPTR data) | |
Initialize from a smart pointer. | |
Vector (const Vector &other) | |
copy constructor | |
~Vector ()=default | |
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) |
TYPE * | getData () |
returns a pointer to our data array | |
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. | |
Vector< TYPE > & | operator*= (TYPE scale) |
multiplication by a scalar | |
Vector< TYPE > & | operator/= (TYPE scale) |
division by a scalar | |
TYPE | normL2Sq () const |
L2 norm squared. | |
TYPE | normL2 () const |
L2 norm. | |
TYPE | normL1 () const |
L1 norm. | |
TYPE | normLinfinity () const |
L-infinity norm. | |
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. | |
unsigned int | largestValId () const |
Gets the ID of the entry that has the largest value. | |
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 | |
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 boost::shared_array<TYPE> RDNumeric::Vector< TYPE >::DATA_SPTR |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
copy constructor
We make a copy of the other vector's data.
Definition at line 67 of file Vector.h.
References RDNumeric::Vector< TYPE >::getData(), and RDNumeric::Vector< TYPE >::size().
|
default |
|
inline |
Copy operator.
We make a copy of the other Vector's data.
Definition at line 117 of file Vector.h.
References RDNumeric::Vector< TYPE >::getData(), PRECONDITION, and RDNumeric::Vector< TYPE >::size().
|
inline |
returns the dot product between two Vectors
Definition at line 249 of file Vector.h.
References RDNumeric::Vector< TYPE >::getData(), PRECONDITION, and RDNumeric::Vector< TYPE >::size().
Referenced by RDNumeric::TanimotoSimilarity().
|
inline |
returns a pointer to our data array
Definition at line 105 of file Vector.h.
Referenced by RDNumeric::Vector< TYPE >::assign(), RDNumeric::Vector< TYPE >::dotProduct(), RDNumeric::SymmMatrix< TYPE >::getCol(), RDNumeric::Matrix< TYPE >::getCol(), RDNumeric::SymmMatrix< TYPE >::getRow(), RDNumeric::Matrix< TYPE >::getRow(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::Vector< TYPE >::operator+=(), RDNumeric::Vector< TYPE >::operator-=(), and RDNumeric::Vector< TYPE >::Vector().
|
inline |
|
inline |
returns the value at a particular index
Definition at line 83 of file Vector.h.
References PRECONDITION.
Referenced by operator<<().
|
inline |
|
inline |
|
inline |
Normalize the vector using the L2 norm.
Definition at line 263 of file Vector.h.
References RDNumeric::Vector< TYPE >::normL2(), and zero_tolerance.
Referenced by RDNumeric::Vector< TYPE >::setToRandom().
|
inline |
|
inline |
L2 norm.
Definition at line 179 of file Vector.h.
References RDNumeric::Vector< TYPE >::normL2Sq().
Referenced by RDNumeric::Vector< TYPE >::normalize().
|
inline |
L2 norm squared.
Definition at line 168 of file Vector.h.
Referenced by RDNumeric::Vector< TYPE >::normL2(), and RDNumeric::TanimotoSimilarity().
|
inline |
|
inline |
|
inline |
elementwise addition, vectors must be the same size.
Definition at line 126 of file Vector.h.
References RDNumeric::Vector< TYPE >::getData(), PRECONDITION, and RDNumeric::Vector< TYPE >::size().
|
inline |
elementwise subtraction, vectors must be the same size.
Definition at line 138 of file Vector.h.
References RDNumeric::Vector< TYPE >::getData(), PRECONDITION, and RDNumeric::Vector< TYPE >::size().
|
inline |
|
inline |
Definition at line 99 of file Vector.h.
References PRECONDITION.
|
inline |
Definition at line 94 of file Vector.h.
References PRECONDITION.
|
inline |
Set to a random unit vector.
Definition at line 272 of file Vector.h.
References RDNumeric::Vector< TYPE >::normalize().
|
inline |
sets the index at a particular value
Definition at line 89 of file Vector.h.
References PRECONDITION.
|
inline |
return the size (dimension) of the vector
Definition at line 80 of file Vector.h.
Referenced by RDNumeric::Vector< TYPE >::assign(), RDNumeric::Vector< TYPE >::dotProduct(), RDNumeric::SymmMatrix< TYPE >::getCol(), RDNumeric::Matrix< TYPE >::getCol(), RDNumeric::SymmMatrix< TYPE >::getRow(), RDNumeric::Matrix< TYPE >::getRow(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::Vector< TYPE >::operator+=(), RDNumeric::Vector< TYPE >::operator-=(), operator<<(), and RDNumeric::Vector< TYPE >::Vector().
|
inline |