#include <SysMatrix.hpp>
Collaboration diagram for SysMatrix< T >:

Public Member Functions | |
| SparseMatrix< T > & | operator() (int i, int j) |
| Returns the block (i, j). | |
| SparseMatrix< T > * | FIBlock (int row) |
| Returns the first initialized block in a row. | |
| void | AttachCoarse (SysMatrix< T > *the_coarse) |
| Access to the coarser level. | |
| SysMatrix< T > * | Coarse () |
| int | NRows () const |
| Returns the number of rows. | |
| int | NCols () const |
| Returns the number of columns. | |
| bool | IsDstVector (GridVec< T > &x) |
| Returns true if 'x' has the right size for the range of the matrix. | |
| void | Reset (int the_n_rows, int the_n_cols) |
| Sets merely the number of blocks. | |
| void | Reset (int the_n_rows, int the_n_cols, const Array< Array< int > > &grid_sizes, const Array< int > &src_blk_size, const Array< int > &dst_blk_size, const Array< int > &min_line_entries) |
| Sets the sizes for the blocks. | |
| void | Reset (int the_n_rows, int the_n_cols, const Array< Array< int > > &grid_sizes, const Array< int > &min_line_entries) |
| Sets the sizes if the blocks are scalar matrices. | |
| void | Reset (const Array< int > &grid_sizes, int the_src_block_size, int the_dst_block_size, int the_min_line_entries=0) |
| Makes a one-row-one-column system. | |
| void | Reset (const Array< int > &grid_sizes, int the_min_line_entries=0) |
| Makes a one-row-one-column system (the scalar version). | |
| SysMatrix () | |
| Creates a dummy object. | |
| SysMatrix (const SysMatrix< T > &src) | |
| Duplication. | |
| SysMatrix (int the_n_rows, int the_n_cols) | |
| Merely sets the numbers of the blocks. | |
| SysMatrix (int the_n_rows, int the_n_columns, const Array< Array< int > > &grid_sizes, const Array< int > &src_blk_size, const Array< int > &dst_blk_size, const Array< int > &min_line_entries) | |
| cf. the remark for 'Reset' | |
| SysMatrix (int the_n_rows, int the_n_columns, const Array< Array< int > > &grid_sizes, const Array< int > &min_line_entries) | |
| The scalar version; cf. the remark for 'Reset'. | |
| SysMatrix (const Array< int > &grid_sizes, int the_src_block_size, int the_dst_block_size, int the_min_line_entries=0) | |
| One block, several components in a block. | |
| SysMatrix (const Array< int > &grid_sizes, int the_min_line_entries=0) | |
| Tne block, the scalar case. | |
| SysMatrix< T > & | SetZero () |
| Sets all the blocks to zero. | |
| SysMatrix< T > & | operator= (const SysMatrix< T > &src) |
| Copies the sizes and the blocks. | |
| SysMatrix< T > & | SetZeroRows (int from_row, int to_row) |
| Sets given rows to zero. | |
| GridVec< T > & | mul (GridVec< T > &x, GridVec< T > &y) |
Operation for a given vector y, returns x. | |
| GridVec< T > & | add_mul (GridVec< T > &x, GridVec< T > &y) |
Multiplication and addition: , for given vectors x, y. Returns x. | |
| GridVec< T > & | sub_mul (GridVec< T > &x, GridVec< T > &y) |
Multiplication and subtraction: for given vectors x, y. Returns x. | |
| GridVec< T > & | add_a_mul (GridVec< T > &x, T a, GridVec< T > &y) |
Multiplication and addition: for given vectors x, y and a scalar a. Returns x. | |
| GridVec< T > & | residual (GridVec< T > &f, GridVec< T > &x, GridVec< T > &r) |
Computation of the residual: for given 'f' and 'x'. Returns r. | |
| T | scal_prod (GridVec< T > &x, GridVec< T > &y) |
The energy scalar product . | |
| SysMatrix< T > & | operator *= (T a) |
| Multiplies 'this' matrix by a scalar. | |
This composite linear operator is represented by a square array of matrices. Note that some matrices in the array may be uninitialized or reset by the Reset() method. These blocks are treated as zero and do not occupy memory. There can be even lines of such uninitialized blocks. For these lines, the sizes of the vectors are not checked. Inserting such lines can be used to define linear operators on a part of a vector.
To create/assemble a SysMatrix , there are two ways:
The template depends on a type T. This type should satisfy the conditions listed in small_matrix.hpp for small matrices.
Merely sets the numbers of the blocks.
| [in] | the_n_rows | |
| [in] | the_n_cols | The numbers of the blocks |
| SysMatrix< T >::SysMatrix | ( | int | the_n_rows, | |
| int | the_n_columns, | |||
| const Array< Array< int > > & | grid_sizes, | |||
| const Array< int > & | src_blk_size, | |||
| const Array< int > & | dst_blk_size, | |||
| const Array< int > & | min_line_entries | |||
| ) | [inline] |
cf. the remark for 'Reset'
| [in] | the_n_rows | |
| [in] | the_n_columns | The numbers of the blocks |
| [in] | grid_sizes | The sizes of the grids |
| [in] | src_blk_size | The sizes of the domain point-blocks |
| [in] | dst_blk_size | The sizes of the range point-blocks |
| [in] | min_line_entries | The min. num. of blocks in lines |
| SysMatrix< T >::SysMatrix | ( | int | the_n_rows, | |
| int | the_n_columns, | |||
| const Array< Array< int > > & | grid_sizes, | |||
| const Array< int > & | min_line_entries | |||
| ) | [inline] |
The scalar version; cf. the remark for 'Reset'.
| [in] | the_n_rows | |
| [in] | the_n_columns | The numbers of the blocks |
| [in] | grid_sizes | The sizes of the grids |
| [in] | min_line_entries | The min. num. of blocks in lines |
| SysMatrix< T >::SysMatrix | ( | const Array< int > & | grid_sizes, | |
| int | the_src_block_size, | |||
| int | the_dst_block_size, | |||
| int | the_min_line_entries = 0 | |||
| ) | [inline] |
One block, several components in a block.
| [in] | grid_sizes | Array of the grid sizes (without the blocks) |
| [in] | the_src_block_size | The size of the blocks of the source vectors |
| [in] | the_dst_block_size | The size of the blocks of the dst. vectors |
| [in] | the_min_line_entries | The mininum num. of blocks in the lines |
| SysMatrix< T >::SysMatrix | ( | const Array< int > & | grid_sizes, | |
| int | the_min_line_entries = 0 | |||
| ) | [inline] |
Tne block, the scalar case.
| [in] | grid_sizes | Array of the grid sizes (without the blocks) |
| [in] | the_min_line_entries | The mininum num. of blocks in the lines |
| SparseMatrix<T>& SysMatrix< T >::operator() | ( | int | i, | |
| int | j | |||
| ) | [inline] |
Returns the block (i, j).
| SparseMatrix<T>* SysMatrix< T >::FIBlock | ( | int | row | ) | [inline] |
Returns the first initialized block in a row.
| [in] | row | The row to look through |
Access to the coarser level.
| int SysMatrix< T >::NRows | ( | ) | const [inline] |
Returns the number of rows.
| int SysMatrix< T >::NCols | ( | ) | const [inline] |
Returns the number of columns.
Returns true if 'x' has the right size for the range of the matrix.
| void SysMatrix< T >::Reset | ( | int | the_n_rows, | |
| int | the_n_cols | |||
| ) | [inline] |
Sets merely the number of blocks.
| [in] | the_n_rows | The numbers of the blocks |
| [in] | the_n_cols | The numbers of the blocks |
| void SysMatrix< T >::Reset | ( | int | the_n_rows, | |
| int | the_n_cols, | |||
| const Array< Array< int > > & | grid_sizes, | |||
| const Array< int > & | src_blk_size, | |||
| const Array< int > & | dst_blk_size, | |||
| const Array< int > & | min_line_entries | |||
| ) | [inline] |
Sets the sizes for the blocks.
| [in] | the_n_rows | |
| [in] | the_n_cols | The numbers of the blocks |
| [in] | grid_sizes | The sizes of the grids |
| [in] | src_blk_size | The sizes of the domain point-blocks |
| [in] | dst_blk_size | The sizes of the range point-blocks |
| [in] | min_line_entries | The min. num. of blocks in lines |
| void SysMatrix< T >::Reset | ( | int | the_n_rows, | |
| int | the_n_cols, | |||
| const Array< Array< int > > & | grid_sizes, | |||
| const Array< int > & | min_line_entries | |||
| ) | [inline] |
Sets the sizes if the blocks are scalar matrices.
| [in] | the_n_rows | |
| [in] | the_n_cols | The numbers of the blocks |
| [in] | grid_sizes | The sizes of the grids |
| [in] | min_line_entries | The min. num. of blocks in lines |
| void SysMatrix< T >::Reset | ( | const Array< int > & | grid_sizes, | |
| int | the_src_block_size, | |||
| int | the_dst_block_size, | |||
| int | the_min_line_entries = 0 | |||
| ) | [inline] |
Makes a one-row-one-column system.
| [in] | grid_sizes | Array of the grid sizes (without the blocks) |
| [in] | the_src_block_size | The size of the blocks of the source vectors |
| [in] | the_dst_block_size | The size of the blocks of the dst. vectors |
| [in] | the_min_line_entries | The mininum num. of blocks in the lines |
| void SysMatrix< T >::Reset | ( | const Array< int > & | grid_sizes, | |
| int | the_min_line_entries = 0 | |||
| ) | [inline] |
Makes a one-row-one-column system (the scalar version).
| [in] | grid_sizes | Array of the grid sizes (without the blocks) |
| [in] | the_min_line_entries | The mininum num. of blocks in the lines |
Sets all the blocks to zero.
| SysMatrix<T>& SysMatrix< T >::operator= | ( | const SysMatrix< T > & | src | ) | [inline] |
Copies the sizes and the blocks.
| SysMatrix<T>& SysMatrix< T >::SetZeroRows | ( | int | from_row, | |
| int | to_row | |||
| ) | [inline] |
Sets given rows to zero.
| [in] | from_row | Index of the first row |
| [in] | to_row | Index of the last row |
| GridVec< T > & SysMatrix< T >::mul | ( | GridVec< T > & | x, | |
| GridVec< T > & | y | |||
| ) | [inline] |
Operation
for a given vector y, returns x.
The arrays x and y may not coincide. The function returns the reference to x. 'x' and 'y' should have the corresponding sizes.
| [in] | x | The result |
| [in] | y | The vector to multiply |
| GridVec< T > & SysMatrix< T >::add_mul | ( | GridVec< T > & | x, | |
| GridVec< T > & | y | |||
| ) | [inline] |
Multiplication and addition:
, for given vectors x, y. Returns x.
The function returns the reference to x. 'x' and 'y' should have the corresponding sizes.
| [in] | x | The first summand and the result |
| [in] | y | The vector to multiply |
| GridVec< T > & SysMatrix< T >::sub_mul | ( | GridVec< T > & | x, | |
| GridVec< T > & | y | |||
| ) | [inline] |
Multiplication and subtraction:
for given vectors x, y. Returns x.
The function returns the reference to x. 'x' and 'y' should have the corresponding sizes.
| [in] | x | The result is saved here |
| [in] | y |
| GridVec< T > & SysMatrix< T >::add_a_mul | ( | GridVec< T > & | x, | |
| T | a, | |||
| GridVec< T > & | y | |||
| ) | [inline] |
Multiplication and addition:
for given vectors x, y and a scalar a. Returns x.
The function returns the reference to x. 'x' and 'y' should have the corresponding sizes.
| [in] | x | The first summand and the result |
| [in] | a | The scalar |
| [in] | y | The vector to multiply |
| GridVec< T > & SysMatrix< T >::residual | ( | GridVec< T > & | f, | |
| GridVec< T > & | x, | |||
| GridVec< T > & | r | |||
| ) | [inline] |
Computation of the residual:
for given 'f' and 'x'. Returns r.
The residual is saved in 'r' which is not expected to be initialized, except for the size. The sizes of 'f' and 'r' should be equal and consistent with the size of 'x'. The function returns the reference to 'r'.
| [in] | f | The right-hand side of the system |
| [in] | x | The current guess of the solution |
| [in] | r | To save the residual |
The energy scalar product
.
'x' and 'y' should have the corresponding sizes.
Multiplies 'this' matrix by a scalar.
| [in] | a | The scalar |
1.5.2