#include <doc.H>
Public Types | |
typedef size_t | size_type |
Type for representing size values. | |
Public Member Functions | |
matrix () | |
Creates empty object. | |
matrix (size_type size1, size_type size2) | |
Creates object w/ size1 rows, size 2 columns. | |
matrix (const matrix &m) | |
Copy constructor. | |
void | resize (size_type size1, size_type size2) |
Resizes object to size1 rows, size 2 columns. | |
size_type | size1 () const |
Returns number of rows. | |
size_type | size2 () const |
Returns number of columns. | |
void | clear () |
Sets all values to 0; keeps size unchanged. | |
void | swap (matrix &m) |
Swaps value of this object and that of the matrix m . | |
const T & | operator() (size_type i, size_type j) const |
Returns value of element in i-th row and j-th column (C++ only). | |
T & | operator() (size_type i, size_type j) |
Returns reference to element in i-th row and j-th column (C++ only). | |
T | get (size_type i, size_type j) const |
Returns value of element in i-th row and j-th column, if elements are a primitive type, e.g., int, double, etc. | |
T & | get (size_type i, size_type j) |
Returns reference to element in i-th row and j-th column, if elements are non-primitive type, i.e., objects (non-C++ only). | |
void | set (size_type i, size_type j, const T &val) |
Sets value of element in i-th row and j-th column to val (non-C++ only). |
Creates object w/ size1
rows, size
2 columns.
Matrix values are uninitialized.
Resizes object to size1
rows, size
2 columns.
Existing values are preserved, but new values are uninitialized.
void matrix< T >::clear | ( | ) |
Sets all values to 0; keeps size unchanged.
Swaps value of this object and that of the matrix m
.
Returns value of element in i-th
row and j-th
column (C++ only).
For example, for a matrix m
, you can use a syntax like m(2, 3)
to access an element. Rows and columns are numbered starting from 0.
Returns reference to element in i-th
row and j-th
column (C++ only).
For example, for a matrix m
, you can use a syntax like m(3, 0) = 4
to assign an element. Rows and columns are numbered starting from 0.
Returns value of element in i-th
row and j-th
column, if elements are a primitive type, e.g., int, double, etc.
(non-C++ only). Rows and columns are numbered starting from 0.
Returns reference to element in i-th
row and j-th
column, if elements are non-primitive type, i.e., objects (non-C++ only).
Rows and columns are numbered starting from 0.
Sets value of element in i-th
row and j-th
column to val
(non-C++ only).
Rows and columns are numbered starting from 0.