Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

Seldon::Vector< T, Vect_Full, Allocator > Class Template Reference

Full vector class. More...

#include <Vector.hxx>

Inheritance diagram for Seldon::Vector< T, Vect_Full, Allocator >:

Seldon::Vector_Base< T, Allocator > List of all members.

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

Public Member Functions

 Vector () throw ()
 Default constructor.
 Vector (int i)
 Main constructor.
 Vector (Vector< T, Vect_Full, Allocator > &A)
 Copy constructor.
 ~Vector ()
 Destructor.
void Clear ()
 Clears the vector.
void Reallocate (int i)
 Vector reallocation.
void SetData (int i, pointer data)
void Nullify ()
 Clears the vector without releasing memory.
reference operator() (int i)
 Access operator.
const_reference operator() (int i) const
 Access operator.
Vector< T, Vect_Full, Allocator > & operator= (const Vector< T, Vect_Full, Allocator > &X)
 Duplicates a vector (assignment operator).
void Copy (const Vector< T, Vect_Full, Allocator > &X)
 Duplicates a vector.
int GetDataSize ()
 Returns the number of elements stored.
void Zero ()
 Sets all elements to zero.
void Fill ()
 Fills the vector with 0, 1, 2, ...
template<class T0>
void Fill (const T0 &x)
 Fills the vector with a given value.
template<class T0>
Vector< T, Vect_Full, Allocator > & operator= (const T0 &X)
 Fills the vector with a given value.
void FillRand ()
 Fills the vector randomly.
void Print () const
 Displays the vector.
value_type GetNormInf () const
 Returns the infinite norm.
int GetNormInfIndex () const
 Returns the index of the highest absolute value.
void Write (string FileName) const
 Writes the vector in a file.
void Write (ofstream &FileStream) const
 Writes the vector in a file stream.
void WriteText (string FileName) const
 Writes the vector in a file.
void WriteText (ofstream &FileStream) const
 Writes the vector in a file stream.
void Read (string FileName)
 Sets the vector from a file.
void Read (ifstream &FileStream)
 Sets the vector from a file stream.

Detailed Description

template<class T, class Allocator>
class Seldon::Vector< T, Vect_Full, Allocator >

Full vector class.

Basic vector class (i.e. not sparse).


Member Function Documentation

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Clear  )  [inline]
 

Clears the vector.

Destructs the vector.

Warning:
On exit, the vector is an empty vector.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Copy const Vector< T, Vect_Full, Allocator > &  X  )  [inline]
 

Duplicates a vector.

Parameters:
X vector to be copied.
Note:
Memory is duplicated: 'X' is therefore independent from the current instance after the copy.

template<class T, class Allocator>
template<class T0>
void Seldon::Vector< T, Vect_Full, Allocator >::Fill const T0 &  x  ) 
 

Fills the vector with a given value.

Parameters:
x value to fill the vector with.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::FillRand  ) 
 

Fills the vector randomly.

Note:
The random generator is very basic.

template<class T, class Allocator>
int Seldon::Vector< T, Vect_Full, Allocator >::GetDataSize  ) 
 

Returns the number of elements stored.

Returns:
The number of elements stored in memory.

template<class T, class Allocator>
Vector< T, Vect_Full, Allocator >::value_type Seldon::Vector< T, Vect_Full, Allocator >::GetNormInf  )  const
 

Returns the infinite norm.

Returns:
The infinite norm.

template<class T, class Allocator>
int Seldon::Vector< T, Vect_Full, Allocator >::GetNormInfIndex  )  const
 

Returns the index of the highest absolute value.

Returns:
The index of the element that has the highest absolute value.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Nullify  ) 
 

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.

Warning:
Memory is not released.

template<class T, class Allocator>
Vector< T, Vect_Full, Allocator >::const_reference Seldon::Vector< T, Vect_Full, Allocator >::operator() int  i  )  const [inline]
 

Access operator.

Parameters:
i index.
Returns:
The value of the vector at 'i'.

template<class T, class Allocator>
Vector< T, Vect_Full, Allocator >::reference Seldon::Vector< T, Vect_Full, Allocator >::operator() int  i  )  [inline]
 

Access operator.

Parameters:
i index.
Returns:
The value of the vector at 'i'.

template<class T, class Allocator>
template<class T0>
Vector< T, Vect_Full, Allocator > & Seldon::Vector< T, Vect_Full, Allocator >::operator= const T0 &  x  ) 
 

Fills the vector with a given value.

Parameters:
x value to fill the vector with.

template<class T, class Allocator>
Vector< T, Vect_Full, Allocator > & Seldon::Vector< T, Vect_Full, Allocator >::operator= const Vector< T, Vect_Full, Allocator > &  X  )  [inline]
 

Duplicates a vector (assignment operator).

Parameters:
X vector to be copied.
Note:
Memory is duplicated: 'X' is therefore independent from the current instance after the copy.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Read ifstream &  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.

Parameters:
FileStream file stream.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::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.

Parameters:
FileName file name.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Reallocate int  i  )  [inline]
 

Vector reallocation.

The vector is resized.

Parameters:
i new length of the vector.
Warning:
Depending on your allocator, initial elements of the vector may be lost.

template<class T, class Allocator>
Seldon::Vector< T, Vect_Full, Allocator >::Vector Vector< T, Vect_Full, Allocator > &  V  ) 
 

Copy constructor.

Builds a copy of a vector.

Parameters:
V vector to be copied.

template<class T, class Allocator>
Seldon::Vector< T, Vect_Full, Allocator >::Vector int  i  )  [explicit]
 

Main constructor.

Builds a vector of a given size.

Parameters:
i length of the vector.

template<class T, class Allocator>
Seldon::Vector< T, Vect_Full, Allocator >::Vector  )  throw () [explicit]
 

Default constructor.

On exit, the vector is empty.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Write ofstream &  FileStream  )  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.

Parameters:
FileStream file stream.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Write string  FileName  )  const
 

Writes the vector in a file.

The length of the vector (integer) and all elements of the vector are stored in binary format.

Parameters:
FileName file name.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::WriteText ofstream &  FileStream  )  const
 

Writes the vector in a file stream.

All elements of the vector are stored in text format. The length is not stored.

Parameters:
FileStream file stream.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, 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.

Parameters:
FileName file name.

template<class T, class Allocator>
void Seldon::Vector< T, Vect_Full, Allocator >::Zero  ) 
 

Sets all elements to zero.

Warning:
It fills the memory with zeros. If the vector stores complex structures, use 'Fill' instead.


The documentation for this class was generated from the following files:
Generated on Sun Jan 16 23:38:03 2005 for Multivac by  doxygen 1.4.0