BlockSparseMatrixEZ< Number > Class Template Reference
[Basic matrices]

Inheritance diagram for BlockSparseMatrixEZ< Number >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 BlockSparseMatrixEZ ()
 BlockSparseMatrixEZ (const unsigned int block_rows, const unsigned int block_cols)
 BlockSparseMatrixEZ (const BlockSparseMatrixEZ< Number > &)
BlockSparseMatrixEZoperator= (const BlockSparseMatrixEZ< Number > &)
BlockSparseMatrixEZoperator= (const double d)
void clear ()
void reinit (const unsigned int n_block_rows, const unsigned int n_block_cols)
void collect_sizes ()
SparseMatrixEZ< Number > & block (const unsigned int row, const unsigned int column)
const SparseMatrixEZ< Number > & block (const unsigned int row, const unsigned int column) const
unsigned int n_block_rows () const
unsigned int n_block_cols () const
bool empty () const
unsigned int n_rows () const
unsigned int n_cols () const
unsigned int m () const
unsigned int n () const
void set (const unsigned int i, const unsigned int j, const Number value)
void add (const unsigned int i, const unsigned int j, const Number value)
template<typename somenumber >
void vmult (BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
template<typename somenumber >
void Tvmult (BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
template<typename somenumber >
void vmult_add (BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
template<typename somenumber >
void Tvmult_add (BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
template<class STREAM >
void print_statistics (STREAM &s, bool full=false)

Private Attributes

BlockIndices row_indices
BlockIndices column_indices
Table< 2, SparseMatrixEZ
< Number > > 
blocks

Detailed Description

template<typename Number>
class BlockSparseMatrixEZ< Number >

A block matrix consisting of blocks of type SparseMatrixEZ.

Like the other Block-objects, this matrix can be used like a SparseMatrixEZ, when it comes to access to entries. Then, there are functions for the multiplication with BlockVector and access to the individual blocks.

Author:
Guido Kanschat, 2002, 2003

Constructor & Destructor Documentation

template<typename Number>
BlockSparseMatrixEZ< Number >::BlockSparseMatrixEZ (  ) 

Default constructor. The result is an empty object with zero dimensions.

template<typename Number>
BlockSparseMatrixEZ< Number >::BlockSparseMatrixEZ ( const unsigned int  block_rows,
const unsigned int  block_cols 
)

Constructor setting up an object with given unmber of block rows and columns. The blocks themselves still have zero dimension.

template<typename Number>
BlockSparseMatrixEZ< Number >::BlockSparseMatrixEZ ( const BlockSparseMatrixEZ< Number > &   ) 

Copy constructor. This is needed for some container classes. It creates an object of the same number of block rows and columns. Since it calls the copy constructor of SparseMatrixEZ, the block s must be empty.


Member Function Documentation

template<typename Number>
BlockSparseMatrixEZ& BlockSparseMatrixEZ< Number >::operator= ( const BlockSparseMatrixEZ< Number > &   ) 

Copy operator. Like the copy constructor, this may be called for objects with empty blocks only.

Reimplemented from Subscriptor.

template<typename Number>
BlockSparseMatrixEZ& BlockSparseMatrixEZ< Number >::operator= ( const double  d  ) 

This operator assigns a scalar to a matrix. Since this does usually not make much sense (should we set all matrix entries to this value? Only the nonzero entries of the sparsity pattern?), this operation is only allowed if the actual value to be assigned is zero. This operator only exists to allow for the obvious notation matrix=0, which sets all elements of the matrix to zero, but keep the sparsity pattern previously used.

template<typename Number>
void BlockSparseMatrixEZ< Number >::clear (  ) 

Set matrix to zero dimensions and release memory.

template<typename Number>
void BlockSparseMatrixEZ< Number >::reinit ( const unsigned int  n_block_rows,
const unsigned int  n_block_cols 
)

Initialize to given block numbers. After this operation, the matrix will have the block dimensions provided. Each block will have zero dimensions and must be initialized subsequently. After setting the sizes of the blocks, collect_sizes() must be called to update internal data structures.

template<typename Number>
void BlockSparseMatrixEZ< Number >::collect_sizes (  ) 

This function collects the sizes of the sub-objects and stores them in internal arrays, in order to be able to relay global indices into the matrix to indices into the subobjects. You *must* call this function each time after you have changed the size of the sub-objects.

template<typename Number >
SparseMatrixEZ< Number > & BlockSparseMatrixEZ< Number >::block ( const unsigned int  row,
const unsigned int  column 
) [inline]
template<typename Number >
const SparseMatrixEZ< Number > & BlockSparseMatrixEZ< Number >::block ( const unsigned int  row,
const unsigned int  column 
) const [inline]

Access the block with the given coordinates. Version for constant objects.

References Assert, BlockSparseMatrixEZ< Number >::blocks, BlockSparseMatrixEZ< Number >::n_block_cols(), and BlockSparseMatrixEZ< Number >::n_block_rows().

template<typename Number >
unsigned int BlockSparseMatrixEZ< Number >::n_block_rows (  )  const [inline]
template<typename Number >
unsigned int BlockSparseMatrixEZ< Number >::n_block_cols (  )  const [inline]
template<typename Number>
bool BlockSparseMatrixEZ< Number >::empty (  )  const

Return whether the object is empty. It is empty if no memory is allocated, which is the same as that both dimensions are zero. This function is just the concatenation of the respective call to all sub-matrices.

template<typename Number >
unsigned int BlockSparseMatrixEZ< Number >::n_rows (  )  const [inline]

Return number of rows of this matrix, which equals the dimension of the image space. It is the sum of rows of the rows of sub-matrices.

References BlockSparseMatrixEZ< Number >::row_indices, and BlockIndices::total_size().

Referenced by BlockSparseMatrixEZ< Number >::m().

template<typename Number >
unsigned int BlockSparseMatrixEZ< Number >::n_cols (  )  const [inline]

Return number of columns of this matrix, which equals the dimension of the range space. It is the sum of columns of the columns of sub-matrices.

References BlockSparseMatrixEZ< Number >::column_indices, and BlockIndices::total_size().

Referenced by BlockSparseMatrixEZ< Number >::n().

template<typename Number >
unsigned int BlockSparseMatrixEZ< Number >::m (  )  const [inline]

Return the dimension of the image space. To remember: the matrix is of dimension $m \times n$.

References BlockSparseMatrixEZ< Number >::n_rows().

template<typename Number >
unsigned int BlockSparseMatrixEZ< Number >::n (  )  const [inline]

Return the dimension of the range space. To remember: the matrix is of dimension $m \times n$.

References BlockSparseMatrixEZ< Number >::n_cols().

template<typename Number >
void BlockSparseMatrixEZ< Number >::set ( const unsigned int  i,
const unsigned int  j,
const Number  value 
) [inline]

Set the element (i,j) to value. Throws an error if the entry does not exist or if value is not a finite number. Still, it is allowed to store zero values in non-existent fields.

References Assert, BlockSparseMatrixEZ< Number >::block(), BlockSparseMatrixEZ< Number >::column_indices, BlockIndices::global_to_local(), numbers::is_finite(), BlockSparseMatrixEZ< Number >::row_indices, and SparseMatrixEZ< number >::set().

template<typename Number >
void BlockSparseMatrixEZ< Number >::add ( const unsigned int  i,
const unsigned int  j,
const Number  value 
) [inline]

Add value to the element (i,j). Throws an error if the entry does not exist or if value is not a finite number. Still, it is allowed to store zero values in non-existent fields.

References SparseMatrixEZ< number >::add(), Assert, BlockSparseMatrixEZ< Number >::block(), BlockSparseMatrixEZ< Number >::column_indices, BlockIndices::global_to_local(), numbers::is_finite(), and BlockSparseMatrixEZ< Number >::row_indices.

template<typename Number >
template<typename somenumber >
void BlockSparseMatrixEZ< Number >::vmult ( BlockVector< somenumber > &  dst,
const BlockVector< somenumber > &  src 
) const [inline]
template<typename Number >
template<typename somenumber >
void BlockSparseMatrixEZ< Number >::Tvmult ( BlockVector< somenumber > &  dst,
const BlockVector< somenumber > &  src 
) const [inline]
template<typename Number >
template<typename somenumber >
void BlockSparseMatrixEZ< Number >::vmult_add ( BlockVector< somenumber > &  dst,
const BlockVector< somenumber > &  src 
) const [inline]
template<typename Number >
template<typename somenumber >
void BlockSparseMatrixEZ< Number >::Tvmult_add ( BlockVector< somenumber > &  dst,
const BlockVector< somenumber > &  src 
) const [inline]
template<typename number >
template<class STREAM >
void BlockSparseMatrixEZ< number >::print_statistics ( STREAM &  s,
bool  full = false 
) [inline]

Print statistics. If full is true, prints a histogram of all existing row lengths and allocated row lengths. Otherwise, just the relation of allocated and used entries is shown.

References BlockSparseMatrixEZ< Number >::block(), SparseMatrixEZ< number >::compute_statistics(), BlockSparseMatrixEZ< Number >::n_block_cols(), and BlockSparseMatrixEZ< Number >::n_block_rows().


Member Data Documentation

template<typename Number>
BlockIndices BlockSparseMatrixEZ< Number >::row_indices [private]

Object storing and managing the transformation of row indices to indices of the sub-objects.

Referenced by BlockSparseMatrixEZ< Number >::add(), BlockSparseMatrixEZ< Number >::n_block_rows(), BlockSparseMatrixEZ< Number >::n_rows(), and BlockSparseMatrixEZ< Number >::set().

template<typename Number>
BlockIndices BlockSparseMatrixEZ< Number >::column_indices [private]

Object storing and managing the transformation of column indices to indices of the sub-objects.

Referenced by BlockSparseMatrixEZ< Number >::add(), BlockSparseMatrixEZ< Number >::n_block_cols(), BlockSparseMatrixEZ< Number >::n_cols(), and BlockSparseMatrixEZ< Number >::set().

template<typename Number>
Table<2, SparseMatrixEZ<Number> > BlockSparseMatrixEZ< Number >::blocks [private]

The actual matrices

Referenced by BlockSparseMatrixEZ< Number >::block().


The documentation for this class was generated from the following file:

deal.II documentation generated on Mon Nov 23 22:57:29 2009 by doxygen 1.6.1