Machine Learning Library
|
templatized vector for numerical applications More...
#include <CMatrix.h>
Public Member Functions | |
virtual | ~CVector () |
virtual CVector< Type > * | clone () const =0 |
destructor More... | |
virtual CVector< double > * | toDouble () const =0 |
create a copy with every element stored as 'double' More... | |
virtual CVector< float > * | toFloat () const =0 |
create a copy with every element stored as 'float' More... | |
virtual vector< Type > | toSTL () const |
virtual CDenseVector< int > | sort ()=0 |
virtual bool | operator== (const CVector< Type > &rhs) const |
returns true if rhs has the same elements More... | |
Type | operator* (const CVector< Type > &) const |
scalar product with vector More... | |
CVector< Type > & | operator*= (const CVector< Type > &) |
multiply vectors elementwise More... | |
CVector< Type > & | operator/= (const CVector< Type > &) |
divide vectors elementwise More... | |
virtual CVector< Type > & | operator*= (const Type &)=0 |
multiply every element with scalar More... | |
virtual CVector< Type > & | operator/= (const Type &)=0 |
divide every element by scalar More... | |
virtual int | dimension (void) const =0 |
return vector dimension More... | |
virtual int | getNumNonZero () const =0 |
returns the number of non-zero entries More... | |
virtual bool | isNaN () const =0 |
returns true if vector contains nan elements More... | |
virtual Type | euclideanLength (bool bQuad=false) const =0 |
returns euclidean length of vector More... | |
virtual const Type & | operator[] (int n) const =0 |
return constant reference to n'th vector element More... | |
virtual Type | getElement (int n) const =0 |
return copy of n'th vector element More... | |
virtual string | className () const |
Returns the class name. More... | |
Type | euclideanDistance (const CVector< Type > &, bool b=false) const |
Type | coCosineDistance (const CVector< Type > &) const |
returns common cosine distance of the two vectors More... | |
void | adaptToVec (const CVector< Type > &, float fEps1, float fEps2) |
virtual bool | serialize (fstream &stream, IO_MODE mode) |
Read/write from binary stream. More... | |
![]() | |
CObject () | |
Constructor. More... | |
virtual | ~CObject () |
Destructor. More... | |
virtual bool | serialize2 (CArchiv &tArchiv) |
void | setVerbose (VERBOSE_LEVEL tVerbose) |
Set the verbose level. More... | |
VERBOSE_LEVEL | verbose (void) const |
Return current verbose level. More... | |
virtual bool | isA (const char *acClass) const |
Check if the object is an instance of the class with given name. More... | |
DATATYPE | dataType () const |
Returns the template data type. More... | |
Static Protected Attributes | |
static const CVectorOperations < Type > & | op_table |
Additional Inherited Members | |
![]() | |
unsigned char | ucVerbose |
templatized vector for numerical applications
base class for a generalized vector. specifies all operations that can be performed on a vector of any type.
void CVector< Type >::adaptToVec | ( | const CVector< Type > & | , |
float | fEps1, | ||
float | fEps2 | ||
) |
adapt vector according to v1 = v1 + eps * (v2-v1)
since v2 might be sparse, we achieve a major speedup, if we formulate the adaptation rule slightly different: v1 = eps2 * v1 + eps1 * v2, where eps2 = 1-eps1
v2 | - vector to adapt to |
fEps1 | - eps1 |
fEps2 | - eps2 |
|
inlinevirtual |
Returns the class name.
Reimplemented from CObject< Type >.
Reimplemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
destructor
create identical copy
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
Referenced by CDatasetItem< Type >::CDatasetItem(), CDatasetItem< Type >::setInputVector(), and CDatasetItem< Type >::setOutputVector().
returns common cosine distance of the two vectors
|
pure virtual |
return vector dimension
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
Referenced by operator+(), and operator-().
Type CVector< Type >::euclideanDistance | ( | const CVector< Type > & | , |
bool | b = false |
||
) | const |
euclidean distance of the two vectors
bQuad | true - return sum of squares; false - return sqrt of that |
|
pure virtual |
returns euclidean length of vector
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
|
pure virtual |
return copy of n'th vector element
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
|
pure virtual |
returns the number of non-zero entries
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
|
pure virtual |
returns true if vector contains nan elements
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
scalar product with vector
multiply vectors elementwise
Referenced by CSparseVector< Type >::operator*=(), and CDenseVector< T >::operator*=().
|
pure virtual |
multiply every element with scalar
Implemented in CDenseVector< Type >, CDenseVector< T >, and CSparseVector< Type >.
divide vectors elementwise
Referenced by CSparseVector< Type >::operator/=(), and CDenseVector< T >::operator/=().
|
pure virtual |
divide every element by scalar
Implemented in CDenseVector< Type >, CDenseVector< T >, and CSparseVector< Type >.
|
virtual |
returns true if rhs has the same elements
|
pure virtual |
return constant reference to n'th vector element
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
|
virtual |
Read/write from binary stream.
The functions handles different data types e.g for reading float objects in a double instance, etc.
fstream | Reference to binary stream |
mode | Switches between reading and writing |
Reimplemented from CObject< Type >.
Reimplemented in CDenseVector< Type >, CDenseVector< double >, and CDenseVector< T >.
|
pure virtual |
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
create a copy with every element stored as 'double'
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
create a copy with every element stored as 'float'
Implemented in CDenseVector< Type >, CDenseVector< double >, CDenseVector< T >, and CSparseVector< Type >.
|
virtual |
Reimplemented in CDenseVector< Type >, CDenseVector< double >, and CDenseVector< T >.
|
staticprotected |