Structure for distributed vectors. More...
#include <VectorCollection.hxx>
Public Types | |
typedef T::value_type | value_type |
typedef T::pointer | pointer |
typedef T::const_pointer | const_pointer |
typedef T::reference | reference |
typedef T::const_reference | const_reference |
typedef T | vector_type |
typedef vector_type * | vector_pointer |
typedef const vector_type * | const_vector_pointer |
typedef vector_type & | vector_reference |
typedef const vector_type & | const_vector_reference |
typedef Vector< vector_type, VectFull, NewAlloc < vector_type > > | collection_type |
typedef const collection_type | const_collection_type |
typedef collection_type & | collection_reference |
typedef const collection_type & | const_collection_reference |
typedef Collection | storage |
Public Member Functions | |
Vector () | |
Methods. | |
Vector (int i) | |
Main constructor. | |
Vector (const Vector< T, Collection, Allocator > &A) | |
Copy constructor. | |
~Vector () | |
Destructor. | |
void | Clear () |
Clears the vector collection. | |
void | Reallocate (int i) |
Reallocates the vector collection. | |
void | Deallocate () |
Clears the vector collection. | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | AddVector (const Vector< T0, Storage0, Allocator0 > &vector) |
Adds a vector to the list of vectors. | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | AddVector (const Vector< T0, Storage0, Allocator0 > &vector, string name) |
Adds a vector to the list of vectors. | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | SetVector (int i, const Vector< T0, Storage0, Allocator0 > &vector) |
Sets a vector in the list of vectors. | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | SetVector (int i, const Vector< T0, Storage0, Allocator0 > &vector, string name) |
Sets a vector in the list of vectors. | |
template<class T0 , class Storage0 , class Allocator0 > | |
void | SetVector (string name, const Vector< T0, Storage0, Allocator0 > &vector) |
Sets a vector in the list of vectors. | |
void | SetName (int i, string name) |
Sets the name of a given underlying vector. | |
void | SetData (const Vector< T, Collection, Allocator > &X) |
Changes the length of the collection and sets its data array. | |
void | Nullify () |
Nullifies vectors of the collection without memory deallocation. | |
int | GetM () const |
Returns the total number of elements. | |
int | GetLength () const |
Returns the total number of elements. | |
int | GetNvector () const |
Returns the number of aggregated vectors. | |
const Vector< int, VectFull, MallocAlloc< int > > & | GetVectorLength () const |
Returns the length vector of the underlying vectors. | |
const Vector< int, VectFull, MallocAlloc< int > > & | GetLengthSum () const |
Returns the cumulative sum of the lengths of the underlying vectors. | |
int | GetVectorIndex (string name) const |
Returns the vector index of the aggregated vector named name. | |
int | GetIndex (string name) const |
Returns the index of the first element of the aggregated vector named name. | |
collection_reference | GetVector () |
Returns the list of vectors. | |
const_collection_reference | GetVector () const |
Returns the list of vectors. | |
vector_reference | GetVector (int i) |
Returns one of the aggregated vectors. | |
const_vector_reference | GetVector (int i) const |
Returns one of the aggregated vectors. | |
vector_reference | GetVector (string name) |
Returns one of the aggregated vectors. | |
const_vector_reference | GetVector (string name) const |
Returns one of the aggregated vectors. | |
const_reference | operator() (int i) const |
Access operator. | |
reference | operator() (int i) |
Access operator. | |
Vector< T, Collection, Allocator > & | operator= (const Vector< T, Collection, Allocator > &X) |
Duplicates a vector collection (assignment operator). | |
void | Copy (const Vector< T, Collection, Allocator > &X) |
Duplicates a vector collection. | |
template<class T0 , class Allocator0 > | |
void | Copy (const Vector< T0, VectFull, Allocator0 > &X) |
Copies the values of a full vector into the current vector. | |
template<class T0 > | |
Vector< T, Collection, Allocator > & | operator*= (const T0 &X) |
Multiplies a vector collection by a scalar. | |
template<class T0 > | |
void | Fill (const T0 &x) |
Fills the collection with a given value. | |
void | Print () const |
Displays the vector. | |
void | Write (string FileName, bool with_size=true) const |
Writes the inner vectors in a file. | |
void | Write (ostream &FileStream, bool with_size=true) const |
Writes the vector in a file stream. | |
void | WriteText (string FileName) const |
Writes the vector in a file. | |
void | WriteText (ostream &FileStream) const |
Writes the vector in a file stream. | |
void | Read (string FileName, Vector< int, VectFull, MallocAlloc< int > > &length_) |
Sets the vector from a file. | |
void | Read (istream &FileStream, Vector< int, VectFull, MallocAlloc< int > > &length_) |
Sets the vector from a file stream. | |
int | GetSize () const |
Returns the number of elements stored. | |
pointer | GetData () const |
Returns a pointer to data_ (stored data). | |
const_pointer | GetDataConst () const |
Returns a const pointer to data_ (stored data). | |
void * | GetDataVoid () const |
Returns a pointer of type "void*" to the data array (data_). | |
const void * | GetDataConstVoid () const |
Returns a pointer of type "const void*" to the data array (data_). | |
Protected Attributes | |
int | Nvector_ |
Vector< int, VectFull, MallocAlloc< int > > | length_ |
Vector< int, VectFull, MallocAlloc< int > > | length_sum_ |
collection_type | vector_ |
map< string, int > | label_map_ |
Indexes of the inner vectors that have a name. | |
vector< string > | label_vector_ |
Names associated with the inner vectors. | |
int | m_ |
pointer | data_ |
Static Protected Attributes | |
static Allocator | vect_allocator_ |
Structure for distributed vectors.
Definition at line 38 of file VectorCollection.hxx.
Seldon::Vector< T, Collection, Allocator >::Vector | ( | ) | [inline, explicit] |
Methods.
Default constructor.
Nothing is allocated. The vector length is set to zero.
Definition at line 46 of file VectorCollection.cxx.
Seldon::Vector< T, Collection, Allocator >::Vector | ( | int | i | ) | [explicit] |
Main constructor.
Builds a vector collection of a given size.
[in] | i | length of the vector. |
Definition at line 58 of file VectorCollection.cxx.
Seldon::Vector< T, Collection, Allocator >::Vector | ( | const Vector< T, Collection, Allocator > & | V | ) |
Copy constructor.
Builds a copy of a vector collection.
[in] | V | vector collection to be copied. |
Definition at line 74 of file VectorCollection.cxx.
Seldon::Vector< T, Collection, Allocator >::~Vector | ( | ) | [inline] |
Destructor.
The inner vectors are nullified so that their memory blocks should not be deallocated.
Definition at line 91 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::AddVector | ( | const Vector< T0, Storage0, Allocator0 > & | 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 167 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Clear | ( | ) | [inline] |
Clears the vector collection.
The inner vectors are nullified so that their memory blocks should not be deallocated.
Definition at line 105 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Copy | ( | const Vector< T, Collection, Allocator > & | X | ) | [inline] |
Duplicates a vector collection.
[in] | X | vector collection to be copied. |
Definition at line 586 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Copy | ( | const Vector< T0, VectFull, Allocator0 > & | X | ) | [inline] |
Copies the values of a full vector into the current vector.
[in] | X | full vector to be copied. |
Definition at line 605 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Deallocate | ( | ) | [inline] |
Clears the vector collection.
The inner vectors are cleared and the memory blocks are deallocated.
Definition at line 141 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Fill | ( | const T0 & | x | ) |
Fills the collection with a given value.
x | value to fill the collection with. |
Definition at line 647 of file VectorCollection.cxx.
Vector_Base< T, Allocator >::pointer Seldon::Vector_Base< T, Allocator >::GetData | ( | ) | const [inherited] |
Returns a pointer to data_ (stored data).
Definition at line 156 of file Vector.cxx.
Vector_Base< T, Allocator >::const_pointer Seldon::Vector_Base< T, Allocator >::GetDataConst | ( | ) | const [inherited] |
Returns a const pointer to data_ (stored data).
Definition at line 168 of file Vector.cxx.
const void * Seldon::Vector_Base< T, Allocator >::GetDataConstVoid | ( | ) | const [inherited] |
Returns a pointer of type "const void*" to the data array (data_).
Definition at line 191 of file Vector.cxx.
void * Seldon::Vector_Base< T, Allocator >::GetDataVoid | ( | ) | const [inherited] |
Returns a pointer of type "void*" to the data array (data_).
Definition at line 180 of file Vector.cxx.
int Seldon::Vector< T, Collection, Allocator >::GetIndex | ( | string | name | ) | const [inline] |
Returns the index of the first element of the aggregated vector named name.
[in] | name | name of the aggregated vector. |
Definition at line 410 of file VectorCollection.cxx.
int Seldon::Vector< T, Collection, Allocator >::GetLength | ( | ) | const [inline] |
Returns the total number of elements.
Reimplemented from Seldon::Vector_Base< T, Allocator >.
Definition at line 345 of file VectorCollection.cxx.
const Vector< int, VectFull, MallocAlloc< int > > & Seldon::Vector< T, Collection, Allocator >::GetLengthSum | ( | ) | const [inline] |
Returns the cumulative sum of the lengths of the underlying vectors.
Definition at line 380 of file VectorCollection.cxx.
int Seldon::Vector< T, Collection, Allocator >::GetM | ( | ) | const [inline] |
Returns the total number of elements.
Reimplemented from Seldon::Vector_Base< T, Allocator >.
Definition at line 334 of file VectorCollection.cxx.
int Seldon::Vector< T, Collection, Allocator >::GetNvector | ( | ) | const [inline] |
Returns the number of aggregated vectors.
Definition at line 356 of file VectorCollection.cxx.
int Seldon::Vector_Base< T, Allocator >::GetSize | ( | ) | const [inherited] |
Returns the number of elements stored.
Definition at line 144 of file Vector.cxx.
Vector< T, Collection, Allocator >::vector_reference Seldon::Vector< T, Collection, Allocator >::GetVector | ( | int | i | ) | [inline] |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 452 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::const_vector_reference Seldon::Vector< T, Collection, Allocator >::GetVector | ( | int | i | ) | const [inline] |
Returns one of the aggregated vectors.
[in] | i | the index of the vector to be returned. |
Definition at line 466 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::vector_reference Seldon::Vector< T, Collection, Allocator >::GetVector | ( | string | name | ) | [inline] |
Returns one of the aggregated vectors.
[in] | name | the name of the vector to be returned. |
Definition at line 479 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::const_vector_reference Seldon::Vector< T, Collection, Allocator >::GetVector | ( | string | name | ) | const [inline] |
Returns one of the aggregated vectors.
[in] | name | the name of the vector to be returned. |
Definition at line 498 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::collection_reference Seldon::Vector< T, Collection, Allocator >::GetVector | ( | ) | [inline] |
Returns the list of vectors.
Definition at line 427 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::const_collection_reference Seldon::Vector< T, Collection, Allocator >::GetVector | ( | ) | const [inline] |
Returns the list of vectors.
Definition at line 439 of file VectorCollection.cxx.
int Seldon::Vector< T, Collection, Allocator >::GetVectorIndex | ( | string | name | ) | const [inline] |
Returns the vector index of the aggregated vector named name.
[in] | name | name of the aggregated vector. |
Definition at line 393 of file VectorCollection.cxx.
const Vector< int, VectFull, MallocAlloc< int > > & Seldon::Vector< T, Collection, Allocator >::GetVectorLength | ( | ) | const [inline] |
Returns the length vector of the underlying vectors.
Definition at line 368 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::const_reference Seldon::Vector< T, Collection, Allocator >::operator() | ( | int | i | ) | const [inline] |
Access operator.
[in] | i | index. |
Definition at line 545 of file VectorCollection.cxx.
Vector< T, Collection, Allocator >::reference Seldon::Vector< T, Collection, Allocator >::operator() | ( | int | i | ) | [inline] |
Access operator.
[in] | i | index. |
Definition at line 521 of file VectorCollection.cxx.
Vector< T, Collection, Allocator > & Seldon::Vector< T, Collection, Allocator >::operator*= | ( | const T0 & | alpha | ) | [inline] |
Multiplies a vector collection by a scalar.
[in] | alpha | scalar. |
Definition at line 627 of file VectorCollection.cxx.
Vector< T, Collection, Allocator > & Seldon::Vector< T, Collection, Allocator >::operator= | ( | const Vector< T, Collection, Allocator > & | X | ) | [inline] |
Duplicates a vector collection (assignment operator).
[in] | X | vector collection to be copied. |
Definition at line 571 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Read | ( | string | FileName, | |
Vector< int, VectFull, MallocAlloc< int > > & | length | |||
) |
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 798 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Read | ( | istream & | FileStream, | |
Vector< int, VectFull, MallocAlloc< int > > & | length | |||
) |
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 824 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::Reallocate | ( | int | i | ) | [inline] |
Reallocates the vector collection.
This method first clears the collection. Then it allocates a new vector of size i, and puts this vector in the collection. On exit, the collection is only composed of this vector of size i.
[in] | i | new size. |
Definition at line 126 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::SetData | ( | const Vector< T, Collection, Allocator > & | X | ) |
Changes the length of the collection and sets its data array.
[in] | X | collection with the vectors to which the current collection will point on exit. |
Definition at line 303 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::SetName | ( | int | i, | |
string | name | |||
) |
Sets the name of a given underlying vector.
[in] | i | a given index. |
[in] | name | name of the underlying vector. |
Definition at line 274 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 | vector to which the i th vector is set. |
[in] | name | new name of the i th vector. |
Definition at line 239 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::SetVector | ( | int | i, | |
const Vector< T0, Storage0, Allocator0 > & | vector | |||
) |
Sets a vector in the list of vectors.
[in] | i | index of the vector to be set. |
[in] | vector | new value of the vector. |
Definition at line 215 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 255 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 706 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 679 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 768 of file VectorCollection.cxx.
void Seldon::Vector< T, Collection, Allocator >::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 740 of file VectorCollection.cxx.