1 #ifndef UTIL_D_RAGGED_MATRIX_H 2 #define UTIL_D_RAGGED_MATRIX_H 11 #include <util/containers/RaggedMatrix.h> 12 #include <util/containers/DArray.h> 23 template <
typename Data>
64 template <
typename Data>
72 template <
typename Data>
89 template <
typename Data>
93 UTIL_THROW(
"Attempt to re-allocate a RaggedMatrix");
96 UTIL_THROW(
"rowSizes.capacity() must be positive");
100 for (
int i = 0; i < rowSizes.
capacity(); ++i) {
102 UTIL_THROW(
"rowSizes must all be nonnegative");
107 UTIL_THROW(
"Sum of row sizes must be positive");
118 capacity2_[i] = rowSizes[i];
128 template <
class Data>
130 {
return !(
data_ == 0); }
Data * data_
One-dimensional C array of all elements.
~DRaggedMatrix()
Destructor.
A 2D array in which different rows can have different lengths.
File containing preprocessor macros for error handling.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void allocate(const DArray< int > &rowSizes)
Allocate memory for a ragged matrix.
Utility classes for scientific computation.
int * capacity2_
Array containing number of elements in each row.
bool isAllocated() const
Return true iff this DRaggedMatrix has been allocated.
int capacity_
Total number of elements.
Data ** rows_
Array of pointers to rows.
Dynamically allocated RaggedMatrix.
DRaggedMatrix()
Constructor.
int capacity() const
Return allocated size.
int capacity1_
Number of rows (range of first index).