ASL
|
A simple 2-dimensional dynamic array or matrix.
For mathematical matrices use class Matrix_ which support arithmetic operations and other functions.
#include <Array2.h>
Public Member Functions | |
Array2 () | |
Creates an empty array. | |
Array2 (int rows, int cols) | |
Creates an array with size rows x cols. | |
Array2 (int rows, int cols, const T &value) | |
Creates an array with size rows x cols and initializes all items with value. | |
Array2 (int rows, int cols, const T *p) | |
Creates an array of rows x cols elements and copies them from the pointer p (row-wise) | |
Array2 (int rows, int cols, std::initializer_list< T > a) | |
Creates an array with size rows x cols and the given elements. | |
Array2 (std::initializer_list< std::initializer_list< T > > a) | |
Creates an array with given list of lists of elements. | |
template<class K > | |
Array2< K > | with () const |
Creates a copy of this array with items converted to type K. | |
Array< T > & | data () |
Returns the internal array holding all values (row-major) More... | |
const Array< T > & | data () const |
Returns the internal array holding all values (row-major) More... | |
Array< T > & | array () |
Returns the internal array holding all values (row-major) | |
const Array< T > & | array () const |
Returns the internal array holding all values (row-major) | |
bool | operator== (const Array2 &b) const |
Returns true if both arrays are equal. | |
bool | operator!= (const Array2 &b) const |
Returns true if both arrays are not equal. | |
Array2 | clone () const |
Returns an independent copy of this array. | |
Array2 | slice (int i1, int i2, int j1, int j2) const |
Returns a sub-array consisting of a rows [i1, i2) and columns [j1, j2) | |
Array2 & | resize (int r, int c) |
Resizes the matrix to r x c. | |
int | rows () const |
Returns the number of rows. | |
int | cols () const |
Returns the number of columns. | |
T & | operator() (int i, int j) |
Returns the item at row i, column j. | |
void | set (const T &x) |
Sets all array items to value x. | |
Array<T>& data | ( | ) |
Returns the internal array holding all values (row-major)
const Array<T>& data | ( | ) | const |
Returns the internal array holding all values (row-major)