Simpatico
v1.10
|
A 2D array in which different rows can have different lengths.
A RaggedMatrix object A is a two-dimensional array in which the operator A(i,j) returns a reference to element j of row i, and in which different rows have different lengths. Class RaggedMatrix cannot be instantiated, and functions like an abstract base class.
The memory for a RaggedMatrix is stored in a one-dimensional C array.
Definition at line 29 of file RaggedMatrix.h.
#include <RaggedMatrix.h>
Public Member Functions | |
virtual | ~RaggedMatrix () |
Destructor. More... | |
int | capacity1 () |
Get number of rows. More... | |
int | capacity2 (int i) |
Get number of elements in row number i. More... | |
const Data & | operator() (int i, int j) const |
Return element (i,j) of matrix by const reference. More... | |
Data & | operator() (int i, int j) |
Return element (i,j) of matrix by reference. More... | |
Protected Member Functions | |
RaggedMatrix () | |
Default constructor. More... | |
Protected Attributes | |
Data * | data_ |
One-dimensional C array of all elements. More... | |
Data ** | rows_ |
Array of pointers to rows. More... | |
int * | capacity2_ |
Array containing number of elements in each row. More... | |
int | capacity1_ |
Number of rows (range of first index). More... | |
int | capacity_ |
Total number of elements. More... | |
|
virtual |
Destructor.
Definition at line 129 of file RaggedMatrix.h.
|
inlineprotected |
Default constructor.
Constructor (protected).
Protected to prevent direct instantiation.
Definition at line 117 of file RaggedMatrix.h.
|
inline |
Get number of rows.
Definition at line 136 of file RaggedMatrix.h.
References Util::RaggedMatrix< Data >::capacity1_.
|
inline |
Get number of elements in row number i.
i | row index |
Definition at line 143 of file RaggedMatrix.h.
References Util::RaggedMatrix< Data >::capacity2_.
|
inline |
Return element (i,j) of matrix by const reference.
i | row index. |
j | column index. |
Definition at line 150 of file RaggedMatrix.h.
References Util::RaggedMatrix< Data >::capacity1_, Util::RaggedMatrix< Data >::capacity2_, Util::RaggedMatrix< Data >::data_, and Util::RaggedMatrix< Data >::rows_.
|
inline |
Return element (i,j) of matrix by reference.
i | row index. |
j | column index. |
Definition at line 164 of file RaggedMatrix.h.
References Util::RaggedMatrix< Data >::capacity1_, Util::RaggedMatrix< Data >::capacity2_, Util::RaggedMatrix< Data >::data_, and Util::RaggedMatrix< Data >::rows_.
|
protected |
One-dimensional C array of all elements.
Definition at line 79 of file RaggedMatrix.h.
Referenced by Util::DRaggedMatrix< Data >::allocate(), Util::DRaggedMatrix< Data >::isAllocated(), Util::RaggedMatrix< Data >::operator()(), and Util::DRaggedMatrix< Data >::~DRaggedMatrix().
|
protected |
Array of pointers to rows.
Definition at line 82 of file RaggedMatrix.h.
Referenced by Util::DRaggedMatrix< Data >::allocate(), Util::RaggedMatrix< Data >::operator()(), and Util::DRaggedMatrix< Data >::~DRaggedMatrix().
|
protected |
Array containing number of elements in each row.
Definition at line 85 of file RaggedMatrix.h.
Referenced by Util::DRaggedMatrix< Data >::allocate(), Util::RaggedMatrix< Data >::capacity2(), Util::RaggedMatrix< Data >::operator()(), and Util::DRaggedMatrix< Data >::~DRaggedMatrix().
|
protected |
Number of rows (range of first index).
Definition at line 88 of file RaggedMatrix.h.
Referenced by Util::DRaggedMatrix< Data >::allocate(), Util::RaggedMatrix< Data >::capacity1(), Util::RaggedMatrix< Data >::operator()(), and Util::DRaggedMatrix< Data >::~DRaggedMatrix().
|
protected |
Total number of elements.
Definition at line 91 of file RaggedMatrix.h.
Referenced by Util::DRaggedMatrix< Data >::allocate(), and Util::DRaggedMatrix< Data >::~DRaggedMatrix().