Structure for distributed vectors. More...
#include <HeterogeneousCollection.hxx>
Public Types | |
typedef Vector< float, VectFull, Allocator< float > > | float_dense_v |
typedef Vector< float, VectSparse, Allocator< float > > | float_sparse_v |
typedef Vector< double, VectFull, Allocator< double > > | double_dense_v |
typedef Vector< double, VectSparse, Allocator< double > > | double_sparse_v |
typedef Vector< float_dense_v, Collection, SELDON_DEFAULT_COLLECTION_ALLOCATOR< float_dense_v > > | float_dense_c |
typedef Vector< float_sparse_v, Collection, SELDON_DEFAULT_COLLECTION_ALLOCATOR< float_sparse_v > > | float_sparse_c |
typedef Vector< double_dense_v, Collection, SELDON_DEFAULT_COLLECTION_ALLOCATOR< double_dense_v > > | double_dense_c |
typedef Vector< double_sparse_v, Collection, SELDON_DEFAULT_COLLECTION_ALLOCATOR< double_sparse_v > > | double_sparse_c |
typedef DenseSparseCollection | storage |
typedef Allocator< T > ::value_type | value_type |
typedef Allocator< T > ::pointer | pointer |
typedef Allocator< T > ::const_pointer | const_pointer |
typedef Allocator< T > ::reference | reference |
typedef Allocator< T > ::const_reference | const_reference |
typedef Allocator< T > | allocator |
Public Member Functions | |
Vector () | |
Default constructor. More... | |
Vector (const Vector< FloatDouble, DenseSparseCollection, Allocator< T > > &) | |
Copy constructor. More... | |
~Vector () | |
Destructor. More... | |
void | Clear () |
Clears the vector collection. More... | |
void | Deallocate () |
Clears the vector collection. More... | |
void | AddVector (const Vector< float, VectFull, Allocator< float > > &) |
Adds a vector to the list of vectors. More... | |
void | AddVector (const Vector< float, VectSparse, Allocator< float > > &) |
Adds a vector to the list of vectors. More... | |
void | AddVector (const Vector< double, VectFull, Allocator< double > > &) |
Adds a vector to the list of vectors. More... | |
void | AddVector (const Vector< double, VectSparse, Allocator< double > > &) |
Adds a vector to the list of vectors. More... | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | AddVector (const Vector< T0, Storage0, Allocator0 > &, string name) |
Adds a vector to the list of vectors. More... | |
void | SetVector (int i, const Vector< float, VectFull, Allocator< float > > &) |
Sets a vector in the list of vectors. More... | |
void | SetVector (int i, const Vector< float, VectSparse, Allocator< float > > &) |
Sets a vector in the list of vectors. More... | |
void | SetVector (int i, const Vector< double, VectFull, Allocator< double > > &) |
Sets a vector in the list of vectors. More... | |
void | SetVector (int i, const Vector< double, VectSparse, Allocator< double > > &) |
Sets a vector in the list of vectors. More... | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | SetVector (int i, const Vector< T0, Storage0, Allocator0 > &, string name) |
Sets a vector in the list of vectors. More... | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | SetVector (string name, const Vector< T0, Storage0, Allocator0 > &) |
Sets a vector in the list of vectors. More... | |
void | SetName (int i, string name) |
Sets a vector in the list of vectors. More... | |
void | Nullify () |
Nullifies vectors of the collection without memory deallocation. | |
int | GetM () const |
Returns the total number of elements. More... | |
int | GetLength () const |
Returns the total number of elements. More... | |
int | GetNvector () const |
Returns the number of aggregated vectors. More... | |
const Vector< int, VectFull, MallocAlloc< int > > & | GetVectorLength () const |
Returns the length vector of the underlying vectors. More... | |
const Vector< int, VectFull, MallocAlloc< int > > & | GetLengthSum () const |
Returns the cumulative sum of the lengths of the underlying vectors. More... | |
const Vector< int, VectFull, MallocAlloc< int > > & | GetCollectionIndex () const |
Returns the collection indexes of the underlying vectors. More... | |
const Vector< int, VectFull, MallocAlloc< int > > & | GetSubvectorIndex () const |
Returns the index of the underlying vectors in the inner collection. More... | |
float_dense_c & | GetFloatDense () |
Returns the list of float dense vectors. More... | |
const float_dense_c & | GetFloatDense () const |
float_sparse_c & | GetFloatSparse () |
Returns the list of float sparse vectors. More... | |
const float_sparse_c & | GetFloatSparse () const |
double_dense_c & | GetDoubleDense () |
Returns the list of double dense vectors. More... | |
const double_dense_c & | GetDoubleDense () const |
double_sparse_c & | GetDoubleSparse () |
Returns the list of double sparse vectors. More... | |
const double_sparse_c & | GetDoubleSparse () const |
void | GetVector (int i, float_dense_v &vector) const |
void | GetVector (int i, float_sparse_v &vector) const |
void | GetVector (int i, double_dense_v &vector) const |
void | GetVector (int i, double_sparse_v &vector) const |
template<class T0 , class Storage0 , class Allocator0 > | |
void | GetVector (string name, Vector< T0, Storage0, Allocator0 > &vector) const |
Returns one of the aggregated vectors. More... | |
double | operator() (int i) const |
Access operator. More... | |
Vector< FloatDouble, DenseSparseCollection, Allocator< T > > & | operator= (const Vector< FloatDouble, DenseSparseCollection, Allocator< T > > &X) |
Duplicates a vector collection (assignment operator). More... | |
void | Copy (const Vector< FloatDouble, DenseSparseCollection, Allocator< T > > &X) |
Duplicates a vector collection. More... | |
template<class T0 > | |
Vector< FloatDouble, DenseSparseCollection, Allocator< T > > & | operator*= (const T0 &X) |
Multiplies a vector collection by a scalar. More... | |
void | Print () const |
Displays the vector. | |
void | Write (string FileName, bool with_size) const |
Writes the inner vectors in a file. More... | |
void | Write (ostream &FileStream, bool with_size) const |
Writes the vector in a file stream. More... | |
void | WriteText (string FileName) const |
Writes the vector in a file. More... | |
void | WriteText (ostream &FileStream) const |
Writes the vector in a file stream. More... | |
void | Read (string FileName) |
Sets the vector from a file. More... | |
void | Read (istream &FileStream) |
Sets the vector from a file stream. More... | |
template<class T , template< class U > class Allocator> | |
void | GetVector (int i, typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::float_dense_v &vector) const |
Returns one of the aggregated vectors. More... | |
template<class T , template< class U > class Allocator> | |
void | GetVector (int i, typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::float_sparse_v &vector) const |
Returns one of the aggregated vectors. More... | |
template<class T , template< class U > class Allocator> | |
void | GetVector (int i, typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::double_dense_v &vector) const |
Returns one of the aggregated vectors. More... | |
template<class T , template< class U > class Allocator> | |
void | GetVector (int i, typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::double_sparse_v &vector) const |
Returns one of the aggregated vectors. More... | |
long | GetM () const |
Returns the number of elements. More... | |
size_t | GetLength () const |
Returns the number of elements. More... | |
size_t | GetSize () const |
Returns the number of elements stored. More... | |
size_t | GetMemorySize () const |
Returns the memory used by the object in bytes. More... | |
pointer | GetData () const |
Returns a pointer to data_ (stored data). More... | |
const_pointer | GetDataConst () const |
Returns a const pointer to data_ (stored data). More... | |
void * | GetDataVoid () const |
Returns a pointer of type "void*" to the data array (data_). More... | |
const void * | GetDataConstVoid () const |
Returns a pointer of type "const void*" to the data array (data_). More... | |
Protected Member Functions | |
string | GetType (int i) const |
Returns the type of an inner vector in a string. More... | |
Protected Attributes | |
int | Nvector_ |
Total number of vectors. | |
Vector< int, VectFull, MallocAlloc< int > > | collection_ |
For each underlying vectors, index of the corresponding collection. | |
Vector< int, VectFull, MallocAlloc< int > > | subvector_ |
Index of the underlying vectors in the inner collection. | |
Vector< int, VectFull, MallocAlloc< int > > | length_ |
Lengths of the underlying vectors. | |
Vector< int, VectFull, MallocAlloc< int > > | length_sum_ |
Cumulative sum of the lengths of the underlying vectors. | |
float_dense_c | float_dense_c_ |
Pointers of the underlying float dense vectors. | |
float_sparse_c | float_sparse_c_ |
Pointers of the underlying float sparse vectors. | |
double_dense_c | double_dense_c_ |
Pointers of the underlying double dense vectors. | |
double_sparse_c | double_sparse_c_ |
Pointers of the underlying float sparse vectors. | |
map< string, int > | label_map_ |
Indexes of the inner vectors that have a name. | |
vector< string > | label_vector_ |
Names associated with the inner vectors. | |
size_t | m_ |
pointer | data_ |
Structure for distributed vectors.
Definition at line 40 of file HeterogeneousCollection.hxx.
|
inlineexplicit |
Default constructor.
Nothing is allocated. The number of vectors is set to zero.
Definition at line 47 of file HeterogeneousCollectionInline.cxx.
|
inline |
Copy constructor.
Builds a copy of a vector collection.
[in] | V | vector collection to be copied. |
Definition at line 60 of file HeterogeneousCollectionInline.cxx.
Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::~Vector |
Destructor.
The inner vectors are nullified so that their memory blocks should not be deallocated.
Definition at line 46 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::AddVector | ( | const Vector< double, VectFull, Allocator< double > > & | vector | ) |
Adds a vector to the list of vectors.
The vector is "appended" to the existing data.
[in] | vector | vector to be appended. |
Definition at line 158 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::AddVector | ( | const Vector< double, VectSparse, Allocator< double > > & | vector | ) |
Adds a vector to the list of vectors.
The vector is "appended" to the existing data.
[in] | vector | vector to be appended. |
Definition at line 177 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::AddVector | ( | const Vector< float, VectFull, Allocator< float > > & | vector | ) |
Adds a vector to the list of vectors.
The vector is "appended" to the existing data.
[in] | vector | vector to be appended. |
Definition at line 120 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::AddVector | ( | const Vector< float, VectSparse, Allocator< float > > & | vector | ) |
Adds a vector to the list of vectors.
The vector is "appended" to the existing data.
[in] | vector | vector to be appended. |
Definition at line 139 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::AddVector | ( | const Vector< T0, Storage0, Allocator0 > & | vector, |
string | name | ||
) |
Adds a vector to the list of vectors.
The vector is "appended" to the existing data.
[in] | vector | vector to be appended. |
[in] | name | name of the vector to be appended. |
Definition at line 198 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Clear |
Clears the vector collection.
The inner vectors are nullified so that their memory blocks should not be deallocated.
Definition at line 69 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Copy | ( | const Vector< FloatDouble, DenseSparseCollection, Allocator< T > > & | X | ) |
Duplicates a vector collection.
[in] | X | vector collection to be copied. |
Definition at line 619 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Deallocate |
Clears the vector collection.
The inner vectors are cleared and the memory blocks are deallocated.
Definition at line 92 of file HeterogeneousCollection.cxx.
|
inline |
Returns the collection indexes of the underlying vectors.
Definition at line 142 of file HeterogeneousCollectionInline.cxx.
|
inlineinherited |
Returns a pointer to data_ (stored data).
Definition at line 177 of file VectorInline.cxx.
|
inlineinherited |
Returns a const pointer to data_ (stored data).
Definition at line 189 of file VectorInline.cxx.
|
inlineinherited |
Returns a pointer of type "const void*" to the data array (data_).
Definition at line 212 of file VectorInline.cxx.
|
inlineinherited |
Returns a pointer of type "void*" to the data array (data_).
Definition at line 201 of file VectorInline.cxx.
|
inline |
Returns the list of double dense vectors.
Definition at line 225 of file HeterogeneousCollectionInline.cxx.
|
inline |
Returns the list of double sparse vectors.
Definition at line 253 of file HeterogeneousCollectionInline.cxx.
|
inline |
Returns the list of float dense vectors.
Definition at line 169 of file HeterogeneousCollectionInline.cxx.
|
inline |
Returns the list of float sparse vectors.
Definition at line 197 of file HeterogeneousCollectionInline.cxx.
|
inlineinherited |
Returns the number of elements.
Definition at line 142 of file VectorInline.cxx.
|
inline |
Returns the total number of elements.
Definition at line 91 of file HeterogeneousCollectionInline.cxx.
|
inline |
Returns the cumulative sum of the lengths of the underlying vectors.
Definition at line 129 of file HeterogeneousCollectionInline.cxx.
|
inlineinherited |
Returns the number of elements.
Definition at line 131 of file VectorInline.cxx.
|
inline |
Returns the total number of elements.
Definition at line 78 of file HeterogeneousCollectionInline.cxx.
|
inlineinherited |
Returns the memory used by the object in bytes.
In this method, the type T is assumed to be "static" such that sizeof(T) provides the correct size
Definition at line 165 of file VectorInline.cxx.
|
inline |
Returns the number of aggregated vectors.
Definition at line 103 of file HeterogeneousCollectionInline.cxx.
|
inlineinherited |
Returns the number of elements stored.
Definition at line 153 of file VectorInline.cxx.
|
inline |
Returns the index of the underlying vectors in the inner collection.
Definition at line 156 of file HeterogeneousCollectionInline.cxx.
|
protected |
Returns the type of an inner vector in a string.
[in] | i | index of the vector. |
Definition at line 1009 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::GetVector | ( | int | i, |
typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::double_dense_v & | vector | ||
) | const |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 489 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::GetVector | ( | int | i, |
typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::double_sparse_v & | vector | ||
) | const |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 519 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::GetVector | ( | int | i, |
typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::float_dense_v & | vector | ||
) | const |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 429 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::GetVector | ( | int | i, |
typename Vector< FloatDouble, DenseSparseCollection, Allocator< T > > ::float_sparse_v & | vector | ||
) | const |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 459 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::GetVector | ( | string | name, |
Vector< T0, Storage0, Allocator0 > & | vector | ||
) | const |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 550 of file HeterogeneousCollection.cxx.
|
inline |
Returns the length vector of the underlying vectors.
Definition at line 116 of file HeterogeneousCollectionInline.cxx.
double Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::operator() | ( | int | i | ) | const |
Access operator.
[in] | i | index. |
Definition at line 575 of file HeterogeneousCollection.cxx.
Vector< FloatDouble, DenseSparseCollection, Allocator< T > > & Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::operator*= | ( | const T0 & | alpha | ) |
Multiplies a vector collection by a scalar.
[in] | alpha | scalar. |
Definition at line 646 of file HeterogeneousCollection.cxx.
|
inline |
Duplicates a vector collection (assignment operator).
[in] | X | vector collection to be copied. |
Definition at line 283 of file HeterogeneousCollectionInline.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Read | ( | istream & | FileStream | ) |
Sets the vector from a file stream.
Sets the vector according to a binary file stream that stores the length of the vector (integer) and all elements.
FileStream | file stream. |
Definition at line 887 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Read | ( | string | FileName | ) |
Sets the vector from a file.
Sets the vector according to a binary file that stores the length of the vector (integer) and all elements.
FileName | file name. |
Definition at line 860 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetName | ( | int | i, |
string | name | ||
) |
Sets a vector in the list of vectors.
[in] | i | a given index. |
[in] | name | name of the underlying vector. |
Definition at line 392 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetVector | ( | int | i, |
const Vector< double, VectFull, Allocator< double > > & | vector | ||
) |
Sets a vector in the list of vectors.
[in] | i | a given index. |
[in] | vector | vector to be appended. |
Definition at line 283 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetVector | ( | int | i, |
const Vector< double, VectSparse, Allocator< double > > & | vector | ||
) |
Sets a vector in the list of vectors.
[in] | i | a given index. |
[in] | vector | vector to be appended. |
Definition at line 319 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetVector | ( | int | i, |
const Vector< float, VectFull, Allocator< float > > & | vector | ||
) |
Sets a vector in the list of vectors.
[in] | i | a given index. |
[in] | vector | vector to be appended. |
Definition at line 212 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetVector | ( | int | i, |
const Vector< float, VectSparse, Allocator< float > > & | vector | ||
) |
Sets a vector in the list of vectors.
[in] | i | a given index. |
[in] | vector | vector to be appended. |
Definition at line 247 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetVector | ( | int | i, |
const Vector< T0, Storage0, Allocator0 > & | vector, | ||
string | name | ||
) |
Sets a vector in the list of vectors.
[in] | i | index of the vector to be set. |
[in] | vector | new value of the vector. |
[in] | name | new name of the vector. |
Definition at line 357 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::SetVector | ( | string | name, |
const Vector< T0, Storage0, Allocator0 > & | vector | ||
) |
Sets a vector in the list of vectors.
[in] | name | name of the vector to be set. |
[in] | vector | new value of the vector. |
Definition at line 373 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Write | ( | ostream & | FileStream, |
bool | with_size = true |
||
) | const |
Writes the vector in a file stream.
The length of the vector (integer) and all elements of the vector are stored in binary format.
FileStream | file stream. |
with_size | if set to 'false', the length of the vector is not saved. |
Definition at line 729 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::Write | ( | string | FileName, |
bool | with_size = true |
||
) | const |
Writes the inner vectors in a file.
The length of the vector (integer) and all elements of the vector are stored in binary format.
FileName | file name. |
with_size | if set to 'false', the length of the vector is not saved. |
Definition at line 701 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::WriteText | ( | ostream & | FileStream | ) | const |
Writes the vector in a file stream.
All elements of the vector are stored in text format. The length is not stored.
FileStream | file stream. |
Definition at line 812 of file HeterogeneousCollection.cxx.
void Seldon::Vector< FloatDouble, DenseSparseCollection, Allocator< T > >::WriteText | ( | string | FileName | ) | const |
Writes the vector in a file.
All elements of the vector are stored in text format. The length is not stored.
FileName | file name. |
Definition at line 783 of file HeterogeneousCollection.cxx.