Full vector class. More...
#include <Vector.hxx>
Public Types | |
typedef Allocator::value_type | value_type |
typedef Allocator::pointer | pointer |
typedef Allocator::const_pointer | const_pointer |
typedef Allocator::reference | reference |
typedef Allocator::const_reference | const_reference |
typedef VectFull | storage |
typedef Allocator | allocator |
Public Member Functions | |
Vector () | |
Default constructor. More... | |
Vector (size_t i) | |
Main constructor. More... | |
Vector (size_t i, pointer data) | |
Vector (const Vector< T, VectFull, Allocator > &A) | |
Copy constructor. More... | |
~Vector () | |
Destructor. | |
void | Clear () |
Clears the vector. More... | |
void | Reallocate (size_t i) |
Vector reallocation. More... | |
void | ReallocateVector (size_t i) |
Vector reallocation. More... | |
void | Resize (size_t i) |
Changes the length of the vector, and keeps previous values. More... | |
void | ResizeVector (size_t i) |
Changes the length of the vector, and keeps previous values. More... | |
void | SetData (size_t i, pointer data) |
template<class Allocator0 > | |
void | SetData (const Vector< T, VectFull, Allocator0 > &V) |
Lets the current vector point to the data of another vector. More... | |
void | Nullify () |
Clears the vector without releasing memory. More... | |
reference | operator() (long i) |
Access operator. More... | |
reference | Get (long i) |
Access to element i. More... | |
const_reference | operator() (long i) const |
Access operator. More... | |
const_reference | Get (long i) const |
Access to element i. More... | |
Vector< T, VectFull, Allocator > & | operator= (const Vector< T, VectFull, Allocator > &X) |
Duplicates a vector (assignment operator). More... | |
void | Copy (const Vector< T, VectFull, Allocator > &X) |
Duplicates a vector. More... | |
Vector< T, VectFull, Allocator > | Copy () const |
Duplicates a vector. More... | |
void | Append (const T &x) |
Appends an element to the vector. More... | |
template<class T0 > | |
void | PushBack (const T0 &x) |
Appends an element at the end of the vector. More... | |
template<class Allocator0 > | |
void | PushBack (const Vector< T, VectFull, Allocator0 > &X) |
Appends a vector X at the end of the vector. More... | |
size_t | GetDataSize () |
Returns the number of elements stored. More... | |
void | Zero () |
Sets all elements to zero. More... | |
void | Fill () |
Fills the vector with 0, 1, 2, ... | |
template<class T0 > | |
void | Fill (const T0 &x) |
Fills the vector with a given value. More... | |
Vector< T, VectFull, Allocator > & | operator= (const T &X) |
Fills the vector with a given value. More... | |
template<class T0 > | |
Vector< T, VectFull, Allocator > & | operator*= (const T0 &X) |
Multiplies a vector by a scalar. More... | |
template<class E > | |
Vector< T, VectFull, Allocator > & | operator= (const VectorExpression< T, E > &) |
Operator =, *this = X where X is an expression. | |
template<class E > | |
Vector< T, VectFull, Allocator > & | operator+= (const VectorExpression< T, E > &) |
Operator +=, *this = *this + X where X is an expression. | |
template<class E > | |
Vector< T, VectFull, Allocator > & | operator-= (const VectorExpression< T, E > &) |
Operator -=, *this = *this - X where X is an expression. | |
void | FillRand () |
Fills the vector randomly. More... | |
void | Print () const |
Displays the vector. | |
ClassComplexType< T >::Treal | GetNormInf () const |
Returns the infinite norm. More... | |
long | GetNormInfIndex () const |
Returns the index of the highest absolute value. More... | |
void | Write (string FileName, bool with_size=true) const |
Writes the vector in a file. More... | |
void | Write (ostream &FileStream, bool with_size=true) 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, bool with_size=true) |
Sets the vector from a file. More... | |
void | Read (istream &FileStream, bool with_size=true) |
Sets the vector from a file stream. More... | |
void | ReadText (string FileName) |
Sets the vector from a file. More... | |
void | ReadText (istream &FileStream) |
Sets the vector from a file stream. 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 Attributes | |
size_t | m_ |
pointer | data_ |
Full vector class.
Basic vector class (i.e. not sparse).
Definition at line 88 of file Vector.hxx.
|
inlineexplicit |
|
inlineexplicit |
Main constructor.
Builds a vector of a given size.
i | length of the vector. |
Definition at line 244 of file VectorInline.cxx.
|
inline |
Copy constructor.
Builds a copy of a vector.
V | vector to be copied. |
Definition at line 300 of file VectorInline.cxx.
|
inline |
Appends an element to the vector.
x | element to be appended. |
Definition at line 665 of file VectorInline.cxx.
|
inline |
Clears the vector.
Destructs the vector.
Definition at line 355 of file VectorInline.cxx.
|
inline |
Duplicates a vector.
Definition at line 600 of file VectorInline.cxx.
|
inline |
Duplicates a vector.
X | vector to be copied. |
Definition at line 584 of file VectorInline.cxx.
|
inline |
Fills the vector with a given value.
x | value to fill the vector with. |
Definition at line 749 of file VectorInline.cxx.
|
inline |
Fills the vector randomly.
Definition at line 777 of file VectorInline.cxx.
|
inline |
Access to element i.
i | index. |
Definition at line 513 of file VectorInline.cxx.
|
inline |
Access to element i.
i | index. |
Definition at line 549 of file VectorInline.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.
|
inline |
Returns the number of elements stored.
Definition at line 710 of file VectorInline.cxx.
|
inlineinherited |
Returns a pointer of type "void*" to the data array (data_).
Definition at line 201 of file VectorInline.cxx.
|
inlineinherited |
Returns the number of elements.
Definition at line 142 of file VectorInline.cxx.
|
inlineinherited |
Returns the number of elements.
Definition at line 131 of file VectorInline.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.
ClassComplexType< T >::Treal Seldon::Vector< T, VectFull, Allocator >::GetNormInf |
long Seldon::Vector< T, VectFull, Allocator >::GetNormInfIndex |
Returns the index of the highest absolute value.
Definition at line 88 of file Vector.cxx.
|
inlineinherited |
Returns the number of elements stored.
Definition at line 153 of file VectorInline.cxx.
|
inline |
Clears the vector without releasing memory.
On exit, the vector is empty and the memory has not been released. It is useful for low level manipulations on a Vector instance.
Definition at line 476 of file VectorInline.cxx.
|
inline |
Access operator.
i | index. |
Definition at line 495 of file VectorInline.cxx.
|
inline |
Access operator.
i | index. |
Definition at line 531 of file VectorInline.cxx.
|
inline |
Multiplies a vector by a scalar.
alpha | scalar. |
Definition at line 612 of file VectorInline.cxx.
|
inline |
Fills the vector with a given value.
x | value to fill the vector with. |
Definition at line 764 of file VectorInline.cxx.
|
inline |
Duplicates a vector (assignment operator).
X | vector to be copied. |
Definition at line 568 of file VectorInline.cxx.
|
inline |
Appends an element at the end of the vector.
x | element to be appended. |
Definition at line 678 of file VectorInline.cxx.
|
inline |
Appends a vector X at the end of the vector.
X | vector to be appended. |
Definition at line 691 of file VectorInline.cxx.
void Seldon::Vector< T, VectFull, Allocator >::Read | ( | istream & | FileStream, |
bool | with_size = true |
||
) |
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. |
with_size | if set to 'false', the length of the vector is not available in the stream. In this case, the current size N of the vector is unchanged, and N elements are read in the stream. |
Definition at line 370 of file Vector.cxx.
void Seldon::Vector< T, VectFull, Allocator >::Read | ( | string | FileName, |
bool | with_size = true |
||
) |
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. |
with_size | if set to 'false', the length of the vector is not available in the file. In this case, the current size N of the vector is unchanged, and N elements are read in the file. |
Definition at line 341 of file Vector.cxx.
void Seldon::Vector< T, VectFull, Allocator >::ReadText | ( | istream & | FileStream | ) |
Sets the vector from a file stream.
Sets all elements of the vector according to a text format. The length is not stored.
FileStream | file stream. |
Definition at line 434 of file Vector.cxx.
void Seldon::Vector< T, VectFull, Allocator >::ReadText | ( | string | FileName | ) |
Sets the vector from a file.
Sets all elements of the vector according to a text format. The length is not stored.
FileName | file name. |
Definition at line 409 of file Vector.cxx.
|
inline |
Vector reallocation.
The vector is resized.
i | new length of the vector. |
Definition at line 369 of file VectorInline.cxx.
|
inline |
Vector reallocation.
The vector is resized.
i | new length of the vector. |
Definition at line 383 of file VectorInline.cxx.
void Seldon::Vector< T, VectFull, Allocator >::Resize | ( | size_t | n | ) |
Changes the length of the vector, and keeps previous values.
Reallocates the vector to size i. Previous values are kept.
n | new length of the vector. |
Definition at line 34 of file Vector.cxx.
void Seldon::Vector< T, VectFull, Allocator >::ResizeVector | ( | size_t | n | ) |
Changes the length of the vector, and keeps previous values.
Reallocates the vector to size i. Previous values are kept.
n | new length of the vector. |
Definition at line 46 of file Vector.cxx.
|
inline |
Lets the current vector point to the data of another vector.
Deallocates memory allocated for the current data array. Then sets the length and the data of the current vector to that of V. On exit, the current vector shares it data array with V.
V | vector whose data should be shared with current instance. |
Definition at line 463 of file VectorInline.cxx.
void Seldon::Vector< T, VectFull, 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 152 of file Vector.cxx.
void Seldon::Vector< T, VectFull, Allocator >::Write | ( | string | FileName, |
bool | with_size = true |
||
) | const |
Writes the vector 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 124 of file Vector.cxx.
void Seldon::Vector< T, VectFull, 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 218 of file Vector.cxx.
void Seldon::Vector< T, VectFull, 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 188 of file Vector.cxx.
|
inline |
Sets all elements to zero.
Definition at line 727 of file VectorInline.cxx.