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 65 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 115 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 247 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 103 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 81 of file Vector.h.
References PRECONDITION.
Referenced by operator<<().
|
inline |
|
inline |
|
inline |
Normalize the vector using the L2 norm.
Definition at line 261 of file Vector.h.
References RDNumeric::Vector< TYPE >::normL2().
Referenced by RDNumeric::Vector< TYPE >::setToRandom().
|
inline |
|
inline |
L2 norm.
Definition at line 177 of file Vector.h.
References RDNumeric::Vector< TYPE >::normL2Sq().
Referenced by RDNumeric::Vector< TYPE >::normalize().
|
inline |
L2 norm squared.
Definition at line 166 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 124 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 136 of file Vector.h.
References RDNumeric::Vector< TYPE >::getData(), PRECONDITION, and RDNumeric::Vector< TYPE >::size().
|
inline |
|
inline |
Definition at line 97 of file Vector.h.
References PRECONDITION.
|
inline |
Definition at line 92 of file Vector.h.
References PRECONDITION.
|
inline |
Set to a random unit vector.
Definition at line 267 of file Vector.h.
References RDNumeric::Vector< TYPE >::normalize().
|
inline |
sets the index at a particular value
Definition at line 87 of file Vector.h.
References PRECONDITION.
|
inline |
return the size (dimension) of the vector
Definition at line 78 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 |