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

Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator > Class Template Reference

Triangular packed matrix class. More...

#include <Matrix_TriangPacked.hxx>

Inheritance diagram for Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >:

Seldon::Matrix_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

 Matrix_TriangPacked ()
 Default constructor.
 Matrix_TriangPacked (int i, int j=0)
 Main constructor.
 ~Matrix_TriangPacked ()
 Destructor.
void Clear ()
 Clears the matrix.
int GetDataSize () const
 Returns the number of elements stored in memory.
void Reallocate (int i, int j)
 Reallocates memory to resize the matrix.
void SetData (int i, int j, pointer data)
value_type operator() (int i, int j)
 Access operator.
value_type operator() (int i, int j) const
 Access operator.
reference Val (int i, int j)
 Direct access method.
const_reference Val (int i, int j) const
 Direct access method.
reference operator[] (int i)
 Access to elements of the data array.
const_reference operator[] (int i) const
 Access to elements of the data array.
Matrix_TriangPacked< T, Prop,
Storage, Allocator > & 
operator= (const Matrix_TriangPacked< T, Prop, Storage, Allocator > &A)
 Duplicates a matrix (assignment operator).
void Copy (const Matrix_TriangPacked< T, Prop, Storage, Allocator > &A)
 Duplicates a matrix.
void Zero ()
 Sets all elements to zero.
void SetIdentity ()
 Sets the matrix to the identity.
void Fill ()
 Fills the matrix with 0, 1, 2, ...
template<class T0>
void Fill (const T0 &x)
 Fills the matrix with a given value.
template<class T0>
Matrix_TriangPacked< T, Prop,
Storage, Allocator > & 
operator= (const T0 &x)
 Fills the matrix with a given value.
void FillRand ()
 Fills the matrix randomly.
void Print () const
 Displays the matrix on the standard output.
void Print (int a, int b, int m, int n) const
 Displays a sub-matrix on the standard output.
void Print (int l) const
 Displays a square sub-matrix on the standard output.
value_type GetNormInf () const
 Returns the maximum (in absolute value) of the matrix.
void Write (string FileName) const
 Writes the matrix in a file.
void Write (ofstream &FileStream) const
 Writes the matrix to an output stream.
void WriteText (string FileName) const
 Writes the matrix in a file.
void WriteText (ofstream &FileStream) const
 Writes the matrix to an output stream.
void Read (string FileName)
 Reads the matrix from a file.
void Read (ifstream &FileStream)
 Reads the matrix from an input stream.

Detailed Description

template<class T, class Prop, class Storage, class Allocator = SELDON_DEFAULT_ALLOCATOR<T>>
class Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >

Triangular packed matrix class.


Constructor & Destructor Documentation

template<class T, class Prop, class Storage, class Allocator>
Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Matrix_TriangPacked  )  [inline]
 

Default constructor.

On exit, the matrix is an empty 0x0 matrix.

template<class T, class Prop, class Storage, class Allocator>
Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Matrix_TriangPacked int  i,
int  j = 0
[inline]
 

Main constructor.

Builds a i x j triangular matrix in packed form.

Parameters:
i number of rows.
j number of columns.
Note:
'j' is assumed to be equal to 'i' and is therefore discarded.


Member Function Documentation

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Clear  )  [inline]
 

Clears the matrix.

Destructs the matrix.

Warning:
On exit, the matrix is an empty 0x0 matrix.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Copy const Matrix_TriangPacked< T, Prop, Storage, Allocator > &  A  )  [inline]
 

Duplicates a matrix.

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

template<class T, class Prop, class Storage, class Allocator>
template<class T0>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Fill const T0 &  x  ) 
 

Fills the matrix with a given value.

Parameters:
x value to fill the matrix with.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Fill  ) 
 

Fills the matrix with 0, 1, 2, ...

On exit, the matrix is filled with 0, 1, 2, 3, ... The order of those numbers depends on the storage.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::FillRand  ) 
 

Fills the matrix randomly.

Note:
The random generator is very basic.

template<class T, class Prop, class Storage, class Allocator>
int Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::GetDataSize  )  const
 

Returns the number of elements stored in memory.

Returns:
The number of elements stored in memory.

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::value_type Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::GetNormInf  )  const
 

Returns the maximum (in absolute value) of the matrix.

Returns:
The maximum (in absolute value) of the matrix.
Note:
The name of this method is of course not relevant since the infinity norm of the matrix is something else. The name of this method will be GetMaxAbs in a next version.

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::value_type Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::operator() int  i,
int  j
const [inline]
 

Access operator.

Returns the value of element (i, j).

Parameters:
i row index.
j column index.
Returns:
Element (i, j) of the matrix.

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::value_type Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::operator() int  i,
int  j
[inline]
 

Access operator.

Returns the value of element (i, j).

Parameters:
i row index.
j column index.
Returns:
Element (i, j) of the matrix.

template<class T, class Prop, class Storage, class Allocator>
template<class T0>
Matrix_TriangPacked< T, Prop, Storage, Allocator > & Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::operator= const T0 &  x  ) 
 

Fills the matrix with a given value.

Parameters:
x value to fill the matrix with.

Reimplemented in Seldon::Matrix< T, Prop, ColUpTriangPacked, Allocator >, Seldon::Matrix< T, Prop, ColLoTriangPacked, Allocator >, Seldon::Matrix< T, Prop, RowUpTriangPacked, Allocator >, and Seldon::Matrix< T, Prop, RowLoTriangPacked, Allocator >.

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator > & Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::operator= const Matrix_TriangPacked< T, Prop, Storage, Allocator > &  A  )  [inline]
 

Duplicates a matrix (assignment operator).

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

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::const_reference Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::operator[] int  i  )  const [inline]
 

Access to elements of the data array.

Provides a direct access to the data array.

Parameters:
i index.
Returns:
i-th element of the data array.

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::reference Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::operator[] int  i  )  [inline]
 

Access to elements of the data array.

Provides a direct access to the data array.

Parameters:
i index.
Returns:
i-th element of the data array.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Print int  l  )  const
 

Displays a square sub-matrix on the standard output.

The sub-matrix is defined by its bottom-right corner (l, l). So, elements with indices in [0, 0] x [l, l] are displayed on the standard output, in text format. Each row is displayed on a single line and elements of a row are delimited by tabulations.

Parameters:
l dimension of the square matrix to be displayed.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Print int  a,
int  b,
int  m,
int  n
const
 

Displays a sub-matrix on the standard output.

The sub-matrix is defined by its upper-left corner (a, b) and its bottom-right corner (m, n). So, elements with indices in [a, m] x [b, n] are displayed on the standard output, in text format. Each row is displayed on a single line and elements of a row are delimited by tabulations.

Parameters:
a row index of the upper-left corner.
b column index of the upper-left corner.
m row index of the bottom-right corner.
n column index of the bottom-right corner.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Print  )  const
 

Displays the matrix on the standard output.

Displays elements on the standard output, in text format. Each row is displayed on a single line and elements of a row are delimited by tabulations.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Read ifstream &  FileStream  ) 
 

Reads the matrix from an input stream.

Reads a matrix in binary format from an input stream. The number of rows (integer) and the number of columns (integer) are read, and matrix elements are then read in the same order as it should be in memory (e.g. row-major storage).

Parameters:
FileStream input stream.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Read string  FileName  ) 
 

Reads the matrix from a file.

Reads a matrix stored in binary format in a file. The number of rows (integer) and the number of columns (integer) are read, and matrix elements are then read in the same order as it should be in memory (e.g. row-major storage).

Parameters:
FileName input file name.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Reallocate int  i,
int  j
[inline]
 

Reallocates memory to resize the matrix.

On exit, the matrix is a i x j matrix.

Parameters:
i new number of rows.
j new number of columns.
Warning:
Depending on your allocator, data may be lost.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::SetData int  i,
int  j,
typename Matrix_TriangPacked< T, Prop, Storage, Allocator >::pointer  data
[inline]
 

The matrix is first cleared (memory is freed). The matrix is then resized to a i x j matrix, and the data array of the matrix is set to 'data'. 'data' elements are not duplicated: the new data array of the matrix is the 'data' array. It is useful to create a matrix from pre-existing data.

Parameters:
i new number of rows.
j new number of columns.
data new array storing elements.
Warning:
'data' has to be used carefully outside the object. Unless you use 'Nullify', 'data' will be freed by the destructor, which means that 'data' must have been allocated carefully. The matrix allocator should be compatible.
Note:
This method should only be used by advanced users.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::SetIdentity  ) 
 

Sets the matrix to the identity.

Warning:
It fills the memory with zeros. If the matrix stores complex structures, discard this method.

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::const_reference Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Val int  i,
int  j
const [inline]
 

Direct access method.

This method allows access to elements stored in memory, i.e. elements from the upper part. i <= j must be satisfied.

Parameters:
i row index.
j column index.
Returns:
The value of the matrix at (i, j).

template<class T, class Prop, class Storage, class Allocator>
Matrix_TriangPacked< T, Prop, Storage, Allocator >::reference Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Val int  i,
int  j
[inline]
 

Direct access method.

This method allows access to elements stored in memory, i.e. elements from the upper part. i <= j must be satisfied.

Parameters:
i row index.
j column index.
Returns:
The value of the matrix at (i, j).

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Write ofstream &  FileStream  )  const
 

Writes the matrix to an output stream.

Writes the matrix to an output stream in binary format. The number of rows (integer) and the number of columns (integer) are written, and matrix elements are then written in the same order as in memory (e.g. row-major storage).

Parameters:
FileStream output stream.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Write string  FileName  )  const
 

Writes the matrix in a file.

Stores the matrix in a file in binary format. The number of rows (integer) and the number of columns (integer) are written, and matrix elements are then written in the same order as in memory (e.g. row-major storage).

Parameters:
FileName output file name.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::WriteText ofstream &  FileStream  )  const
 

Writes the matrix to an output stream.

Writes the matrix to an output stream in text format. Only matrix elements are written (not dimensions). Each row is written on a single line and elements of a row are delimited by tabulations.

Parameters:
FileStream output stream.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::WriteText string  FileName  )  const
 

Writes the matrix in a file.

Stores the matrix in a file in text format. Only matrix elements are written (not dimensions). Each row is written on a single line and elements of a row are delimited by tabulations.

Parameters:
FileName output file name.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::Matrix_TriangPacked< T, Prop, Storage, Allocator >::Zero  ) 
 

Sets all elements to zero.

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


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