SCPPNT::const_Region2D< Array2D > Class Template Reference

Constant version of Region2D. More...

#include <region2d.h>

List of all members.

Public Types

typedef const Array2D array_type
 Type of matrix underlying region.
typedef Array2D::size_type size_type
 Subscript type.
typedef Array2D::value_type value_type
 Type of elements stored in matrix.
typedef Array2D::element_type element_type
 Type of elements stored in matrix.
typedef Array2D::pointer pointer
 Pointer to type stored in matrix.
typedef Array2D::reference reference
 Reference to type stored in matrix.
typedef Array2D::const_reference const_reference
 Reference to type stored in constant matrix.
typedef Array2D::const_row_iterator const_row_iterator
 Iterator over constant elements of a row.
typedef
Array2D::const_column_iterator 
const_column_iterator
 Iterator over elements of a column.
typedef const_row_iteratorconst_rows_iterator
 Iterator over row iterators (points to const_row_iterator object for a row).
typedef const_column_iteratorconst_columns_iterator
 Iterator over column iterators (points to const_column_iterator object for a column).
typedef Region2D_iterator
< value_type, typename
const_Region2D< Array2D >
::const_rows_iterator
const_iterator
 Iterator over all constant elements ("typename" keyword added. ww, 12-8-2007).
typedef
Array2D::const_diag_iterator 
const_diag_iterator
 Iterator over constant elements of a matrix diagonal.

Public Member Functions

const array_typearray () const
 Return matrix that is the basis of the view.
Subscript num_rows () const
 Return number of rows in matrix.
Subscript num_columns () const
 Return number of columns in matrix.
Subscript lbound () const
 Returns lower bound of subscript.
Subscript dim (Subscript i) const
 Return number of rows if argument is 1, number of columns if argument is 2.
Subscript size () const
 Return total number of elements in matrix.
 const_Region2D (const Array2D &A, Subscript i1, Subscript i2, Subscript j1, Subscript j2)
 Constructor from lower and upper limits for rows and columns.
 const_Region2D (const Array2D &A, const Index1D &I, const Index1D &J)
 Constructor using row and column index ranges.
 const_Region2D (const Array2D &A)
 Create a region containing entire matrix (convertion of matrix to region).
 const_Region2D (const const_Region2D< Array2D > &A, Subscript i1, Subscript i2, Subscript j1, Subscript j2)
 Constructor from region.
 const_Region2D (const const_Region2D< Array2D > &A)
 Copy constructor.
 ~const_Region2D ()
 Destructor.
const_row_iterator operator[] (Subscript i) const
 Return iterator to constant elements in row i+1 (0-based subscripting).
const_reference operator() (Subscript i, Subscript j) const
 Return constant element in row i and column j, where i and j are 1-based indices.
const_Region2D< Array2D > operator() (Subscript i1, Subscript i2, Subscript j1, Subscript j2)
 Return new region that is subregion of this region.
const_Region2D< Array2D > operator() (const Index1D &I, const Index1D &J)
 Return new region that is subregion of this region.
const_rows_iterator begin_rows () const
 Return iterator pointing to row iterator for first row (iterator over row iterators).
const_columns_iterator begin_columns () const
 Return iterator pointing to column iterator for first column (iterator over column iterators).
const_rows_iterator end_rows () const
 Return iterator pointing to row iterator for one past last row (iterator over row iterators).
const_columns_iterator end_columns () const
 Return iterator pointing to column iterator for one past last column (iterator over column iterators).
const_row_iterator begin_row (Subscript index) const
 Return iterator pointing to first element in row 'index' (1-offset).
const_column_iterator begin_column (Subscript index) const
 Return iterator over constant elements in column 'index' (1-offset).
const_row_iterator end_row (Subscript index) const
 Return iterator pointing to one past last element in row 'index' (1-offset).
const_column_iterator end_column (Subscript index) const
 Return iterator pointing to one past last element in column 'index' (1-offset).
const_iterator begin () const
 Return iterator pointing to first element of matrix (constant version).
const_iterator end () const
 Return iterator pointing to one past last element of matrix.
const_diag_iterator begin_diagonal (Subscript row, Subscript column) const
 Returns iterator pointing to first element of matrix diagonal.
const_diag_iterator end_diagonal (Subscript row, Subscript column) const
 Returns iterator pointing to one past the last element of matrix diagonal.


Detailed Description

template<class Array2D>
class SCPPNT::const_Region2D< Array2D >

Constant version of Region2D.

View of a rectangular subset of a constant matrix. All operations that can be done with a SCPPNT::Matrix can be done with a Region2D. Note this is a view of the original matrix so all operations take place using elements of the original matrix, not copies.

Parameters:
Array2D Matrix type that forms the basis of the view. Requires interface consistent with SCPPNT::Matrix.

Definition at line 1033 of file region2d.h.


Constructor & Destructor Documentation

template<class Array2D>
SCPPNT::const_Region2D< Array2D >::const_Region2D ( const Array2D &  A,
Subscript  i1,
Subscript  i2,
Subscript  j1,
Subscript  j2 
) [inline]

Constructor from lower and upper limits for rows and columns.

Parameters:
A Matrix to use as basis of region.
i1 Index in original matrix of first row in region (1-based).
i2 Index in original matrix of last row in region (1-based).
j1 Index in original matrix of first column in region (1-based).
j2 Index in original matrix of last column in region (1-based).

Definition at line 1125 of file region2d.h.

01126                       : A_(A)
01127     {
01128       initialize(i1, i2, j1, j2);
01129     }

template<class Array2D>
SCPPNT::const_Region2D< Array2D >::const_Region2D ( const Array2D &  A,
const Index1D I,
const Index1D J 
) [inline]

Constructor using row and column index ranges.

Parameters:
A Matrix to use as basis of region
I Gives first and last rows of original matrix to use in region.
J Gives first and last columns of original matrix to use in region.

Definition at line 1137 of file region2d.h.

References SCPPNT::Index1D::lbound(), and SCPPNT::Index1D::ubound().

01137                                                                          : A_(A)
01138     {
01139       initialize(I.lbound(), I.ubound(), J.lbound(), J.ubound());
01140     }

Here is the call graph for this function:

template<class Array2D>
SCPPNT::const_Region2D< Array2D >::const_Region2D ( const const_Region2D< Array2D > &  A,
Subscript  i1,
Subscript  i2,
Subscript  j1,
Subscript  j2 
) [inline]

Constructor from region.

Parameters:
A Region to use as basis of region.
i1 Index in original region of first row in new region (1-based).
i2 Index in original region of last row in new region (1-based).
j1 Index in original region of first column in new region (1-based).
j2 Index in original region of last column in new region (1-based).

Definition at line 1156 of file region2d.h.

References SCPPNT::const_Region2D< Array2D >::offset_.

01157     : A_(A.A_)
01158     {
01159       initialize(i1 + A.offset_[0], i2 + A.offset_[0], j1 + A.offset_[1], j2 + A.offset_[1]);
01160     }


Member Function Documentation

template<class Array2D>
const_Region2D<Array2D> SCPPNT::const_Region2D< Array2D >::operator() ( Subscript  i1,
Subscript  i2,
Subscript  j1,
Subscript  j2 
) [inline]

Return new region that is subregion of this region.

Parameters:
i1 Smallest row in current region to be contained in subregion (1-based)
i2 Largest row in current region to be contained in subregion (1-based)
j1 Smallest column in current region to be contained in subregion (1-based)
j2 Largest column in current region to be contained in subregion (1-based)

Definition at line 1196 of file region2d.h.

01198     {
01199       return const_Region2D<Array2D>(A_,
01200           i1+offset_[0], offset_[0] + i2,
01201           j1+offset_[1], offset_[1] + j2);
01202     }

template<class Array2D>
const_Region2D<Array2D> SCPPNT::const_Region2D< Array2D >::operator() ( const Index1D I,
const Index1D J 
) [inline]

Return new region that is subregion of this region.

Parameters:
I Smallest and largest rows of current retion to be contained in subregion (1-based)
I Smallest and largest columns of current retion to be contained in subregion (1-based)

Definition at line 1209 of file region2d.h.

References SCPPNT::Index1D::lbound(), and SCPPNT::Index1D::ubound().

01211     {
01212       return const_Region2D<Array2D>(A_, I.lbound()+offset_[0],
01213           offset_[0] + I.ubound(), offset_[1]+J.lbound(),
01214           offset_[1] + J.ubound());
01215     }

Here is the call graph for this function:

template<class Array2D>
const_Region2D< Array2D >::const_rows_iterator SCPPNT::const_Region2D< Array2D >::begin_rows (  )  const [inline]

Return iterator pointing to row iterator for first row (iterator over row iterators).

Return iterator pointing to row iterator for first row (constant version).

Definition at line 1377 of file region2d.h.

01378   {
01379 #ifdef SCPPNT_BOUNDS_CHECK
01380     return const_rows_iterator(const_row_, 1, dim_[0]);
01381 #else
01382     return const_row_;
01383 #endif
01384   }

template<class Array2D>
const_Region2D< Array2D >::const_columns_iterator SCPPNT::const_Region2D< Array2D >::begin_columns (  )  const [inline]

Return iterator pointing to column iterator for first column (iterator over column iterators).

Return iterator pointing to column iterator for first column (constant version).

Definition at line 1388 of file region2d.h.

01389   {
01390 #ifdef SCPPNT_BOUNDS_CHECK
01391     return const_columns_iterator(const_column_, 1, dim_[1]);
01392 #else
01393     return const_column_;
01394 #endif
01395   }

template<class Array2D>
const_Region2D< Array2D >::const_diag_iterator SCPPNT::const_Region2D< Array2D >::begin_diagonal ( Subscript  row,
Subscript  column 
) const [inline]

Returns iterator pointing to first element of matrix diagonal.

Returns iterator pointing to the first element of the matrix diagonal given by (row, column), (row+1, column+1), (row+2, column+2), ... For example, if row=1 and column=1 then an iterator pointing to the first element of the main diagnonal is returned.

Parameters:
row 1-based row number for initial element of diagonal.
column 1-based column number for initial element of diagonal.

Definition at line 1441 of file region2d.h.

Referenced by SCPPNT::const_Region2D< Array2D >::end_diagonal().

01442   {
01443     const_diag_iterator it = A_.begin_diagonal(row + offset_[0], column + offset_[1]);
01444 
01445 #ifdef SCPPNT_BOUNDS_CHECK
01446     it.set_size(diagonal_size(row, column));
01447 #endif
01448 
01449     return it;
01450   }

Here is the caller graph for this function:

template<class Array2D>
const_Region2D< Array2D >::const_diag_iterator SCPPNT::const_Region2D< Array2D >::end_diagonal ( Subscript  row,
Subscript  column 
) const [inline]

Returns iterator pointing to one past the last element of matrix diagonal.

Returns iterator pointing to the one past last element of the matrix diagonal given by (row, column), (row+1, column+1), (row+2, column+2), ... For example, for a square matrix with n rows and columns end_diagonal(1, 1) returns an iterator pointing to the element (row+n, column+n), which is one past the last element of the main diagonal.

Parameters:
row 1-based row number for initial element of diagonal.
column 1-based column number for initial element of diagonal.

Definition at line 1465 of file region2d.h.

References SCPPNT::const_Region2D< Array2D >::begin_diagonal().

01466   {
01467 
01468     const_diag_iterator it = begin_diagonal(row, column);
01469     return it + diagonal_size(row, column);
01470   }

Here is the call graph for this function:


The documentation for this class was generated from the following file:
Generated on Tue Dec 18 23:34:40 2007 for SCPPNT by  doxygen 1.5.4