A class for 2D arrays stored in column-major (Fortran-compatible) form.
In this form, the data entry for an n row, m col matrix is
index = i + (n-1) * j
where
J(i,j) = data_start + index
i = row
j = column
Definition at line 31 of file Array.h.
|
| Array2D ()=default |
| Default constructor.
|
|
| Array2D (const size_t m, const size_t n, const double v=0.0) |
| Constructor.
|
|
| Array2D (const size_t m, const size_t n, const double *values) |
| Constructor.
|
|
| Array2D (const Array2D &y) |
|
Array2D & | operator= (const Array2D &y) |
|
virtual void | resize (size_t n, size_t m, double v=0.0) |
| Resize the array, and fill the new entries with 'v'.
|
|
void | appendColumn (const vector< double > &c) |
| Append a column to the existing matrix using a std vector.
|
|
void | appendColumn (const double *const c) |
| Append a column to the existing matrix.
|
|
void | setRow (size_t n, const double *const rw) |
| Set the nth row to array rw.
|
|
void | getRow (size_t n, double *const rw) |
| Get the nth row and return it in a vector.
|
|
void | setColumn (size_t m, double *const col) |
| Set the values in column m to those in array col.
|
|
void | getColumn (size_t m, double *const col) |
| Get the values in column m.
|
|
void | zero () |
| Set all of the entries to zero.
|
|
double & | operator() (size_t i, size_t j) |
| Allows setting elements using the syntax A(i,j) = x.
|
|
double | operator() (size_t i, size_t j) const |
| Allows retrieving elements using the syntax x = A(i,j).
|
|
double & | value (size_t i, size_t j) |
| Returns a changeable reference to position in the matrix.
|
|
double | value (size_t i, size_t j) const |
| Returns the value of a single matrix entry.
|
|
size_t | nRows () const |
| Number of rows.
|
|
size_t | nColumns () const |
| Number of columns.
|
|
iterator | begin () |
| Return an iterator pointing to the first element.
|
|
iterator | end () |
| Return an iterator pointing past the last element.
|
|
const_iterator | begin () const |
| Return a const iterator pointing to the first element.
|
|
const_iterator | end () const |
| Return a const iterator pointing to past the last element.
|
|
vector< double > & | data () |
| Return a reference to the data vector.
|
|
const vector< double > & | data () const |
| Return a const reference to the data vector.
|
|
void | operator*= (double a) |
|
double * | ptrColumn (size_t j) |
| Return a pointer to the top of column j, columns are contiguous in memory.
|
|
const double * | ptrColumn (size_t j) const |
| Return a const pointer to the top of column j, columns are contiguous in memory.
|
|