template
class
Array2D<class>
(Return to index)
Two-dimensional array.
A templated representation for 2-dimensional arrays.
This class implements storage management and component access,
as well as access to rows and columns, but contains no arithmetic
operations.
Type: |
Instantiable |
Include file: |
./Algebra/Array2D.hh |
Inheritance
Synopsis (including inherited members):
- Public members:
-
typedef T value_type
;
-
typedef T* iterator
;
-
typedef const T* const_iterator
;
-
typedef T* row_iterator
;
-
typedef const T* const_row_iterator
;
-
typedef SliceIterator<T> col_iterator
;
-
typedef ConstSliceIterator<T> const_col_iterator
;
-
Array2D
()
;
-
Array2D
(int,int)
;
-
Array2D
(int,int,const T&)
;
-
Array2D
(const Array2D&)
;
-
~Array2D
()
;
-
Array2D<T>& operator=
(const Array2D<T>&)
;
-
T& operator()
(int,int)
;
-
const T& operator()
(int,int)const
;
-
int nrows
()const
;
-
int ncols
()const
;
-
int size
()const
;
-
iterator begin
()
;
-
iterator end
()
;
-
const_iterator begin
()const
;
-
const_iterator end
()const
;
-
row_iterator row_begin
(int)
;
-
row_iterator row_end
(int)
;
-
const_row_iterator row_begin
(int)const
;
-
const_row_iterator row_end
(int)const
;
-
row_iterator operator[]
(int)
;
-
const_row_iterator operator[]
(int)const
;
-
col_iterator col_begin
(int)
;
-
col_iterator col_end
(int)
;
-
const_col_iterator col_begin
(int)const
;
-
const_col_iterator col_end
(int)const
;
-
void getColumn
(Array1D<T>&,int)const
;
-
void getRow
(Array1D<T>&,int)const
;
-
void putColumn
(const Array1D<T>&,int)
;
-
void putRow
(const Array1D<T>&,int)
;
-
void swapColumns
(int,int)
;
-
void swapRows
(int,int)
;
- Protected Members:
-
int rows
;
-
int cols
;
-
int len
;
-
T* data
;
Documentation:
- Public members:
-
Array2D
()
;
- Default constructor.
Constructs array of zero rows and zero columns.
-
Array2D
(int,int)
;
- Constructor.
Reserves rows times cols elements and leaves
them undefined.
-
Array2D
(int,int,const T&)
;
- Constructor.
Reserves rows x cols elements and sets them to t.
-
iterator begin
()
;
- Get pointer to beginning of data.
Treat the array as one-dimensional.
Version for non-constant objects.
-
const_iterator begin
()const
;
- Get pointer to beginning of data.
Treat the array as one-dimensional.
Version for constant objects.
-
col_iterator col_begin
(int)
;
- Get column iterator.
Return pointer to beginning of column c.
Throw RangeError if c is out of range.
Version for non-constant objects.
-
const_col_iterator col_begin
(int)const
;
- Get column iterator.
Return pointer to beginning of column c.
Throw RangeError if c is out of range.
Version for constant objects.
-
col_iterator col_end
(int)
;
- Get column iterator.
Return pointer past end of column c.
Throw RangeError if c is out of range.
Version for non-constant objects.
-
const_col_iterator col_end
(int)const
;
- Get column iterator.
Return pointer past end of column c.
Throw RangeError if c is out of range.
Version for constant objects.
-
typedef SliceIterator<T> col_iterator
;
- The iterator type for access by columns.
-
typedef ConstSliceIterator<T> const_col_iterator
;
- The iterator type for access by columns for a constant array.
-
typedef const T* const_iterator
;
- The iterator type for sequential access to all elements
of a constant array.
-
typedef const T* const_row_iterator
;
- The iterator type for access by rows for a constant array.
-
iterator end
()
;
- Get pointer past end of data.
Treat the array as one-dimensional.
Version for non-constant objects.
-
const_iterator end
()const
;
- Get pointer past end of data.
Treat the array as one-dimensional.
Version for constant objects.
-
void getColumn
(Array1D<T>&,int)const
;
- Fetch column.
Store the column c into the array toArray.
Throw RangeError if c is out of range.
-
void getRow
(Array1D<T>&,int)const
;
- Fetch row.
Store the row r into the array toArray.
Throw RangeError if r is out of range.
-
typedef T* iterator
;
- The iterator type for sequential access to all elements.
-
int ncols
()const
;
- Get number of columns.
-
int nrows
()const
;
- Get number of rows.
-
T& operator()
(int,int)
;
- Get element reference.
Return a reference to element in row r and column c.
-
const T& operator()
(int,int)const
;
- Get element value.
Return the value of element in row r and column c.
-
row_iterator operator[]
(int)
;
- Get row iterator.
Return pointer to beginning of row r.
Result is undefined, if r is out of range.
Version for non-constant objects.
-
const_row_iterator operator[]
(int)const
;
- Get row iterator.
Return pointer to beginning of row r.
Result is undefined, if r is out of range.
Version for constant objects.
-
void putColumn
(const Array1D<T>&,int)
;
- Store column.
Fill the column c from the array fromArray.
Throw RangeError if c is out of range.
-
void putRow
(const Array1D<T>&,int)
;
- Store row.
Fill the row r from the array fromArray.
Throw RangeError if r is out of range.
-
row_iterator row_begin
(int)
;
- Get row iterator.
Return pointer to beginning of row r.
Throw RangeError, if row is out of range.
Version for non-constant objects.
-
const_row_iterator row_begin
(int)const
;
- Get row iterator.
Return pointer to beginning of constant row r.
Throws RangeError, if row is out of range.
Version for constant objects.
-
row_iterator row_end
(int)
;
- Get row iterator.
Return pointer past end of row r.
Throw RangeError, if row is out of range.
Version for non-constant objects.
-
const_row_iterator row_end
(int)const
;
- Get row iterator.
Return pointer past end of constant row r.
Throws RangeError, if row is out of range.
Version for constant objects.
-
typedef T* row_iterator
;
- The iterator type for access by rows.
-
int size
()const
;
- Get total size (rows times columns).
-
void swapColumns
(int,int)
;
- Exchange columns.
Exchange the columns c1 and c2.
Throw RangeError, if either index is out of range.
-
void swapRows
(int,int)
;
- Exchange rows.
Exchange the rows r1 and r2.
Throw RangeError, if either index is out of range.
-
typedef T value_type
;
- The value type of the array.
- Protected members:
Documentation generated by fci on Mon Feb 7 11:41:31 2000