1#ifndef UTIL_RAGGED_MATRIX_H
2#define UTIL_RAGGED_MATRIX_H
28 template <
typename Data>
116 template <
typename Data>
128 template <
typename Data>
135 template <
typename Data>
137 {
return capacity1_; }
142 template <
typename Data>
144 {
return capacity2_[i]; }
149 template <
typename Data>
155 assert(i < capacity1_);
157 assert(j < capacity2_[i]);
158 return *(rows_[i] + j);
164 template <
typename Data>
169 assert(i < capacity1_);
171 assert(j < capacity2_[i]);
172 return *(rows_[i] + j);
A 2D array in which different rows can have different lengths.
int capacity1_
Number of rows (range of first index).
int * capacity2_
Array containing number of elements in each row.
Data const & operator()(int i, int j) const
Return element (i,j) of matrix by const reference.
Data ** rows_
Array of pointers to rows.
int capacity_
Total number of elements.
RaggedMatrix()
Default constructor.
int capacity1()
Get number of rows.
int capacity2(int i)
Get number of elements in row number i.
virtual ~RaggedMatrix()
Destructor.
Data * data_
One-dimensional C array of all elements.
File containing preprocessor macros for error handling.
Utility classes for scientific computation.