|
| ms_matrix () |
| Construct empty matrix.
|
|
| ms_matrix (const matrix_t &m) |
| Construct a copy of a matrix.
|
|
| ms_matrix (size_t si, size_t sj, double v=0.0) |
| Construct a rectangular matrix.
|
|
const matrix_t & | data () const |
| Get the internal constant matrix data.
|
|
double | getCR (size_t i, size_t j) const |
| Get the value for the specified row and column.
|
|
double | getRC (size_t i, size_t j) const |
| Get the value for the specified row and column.
|
|
bool | isZero () const |
| Return true if all values are zero.
|
|
void | logContents (ms_errs &errs, const char *description) const |
| Dump the contents of the matrix to the log.
|
|
double | multiplyByRow (const std::vector< double > &column, size_t row) const |
| Multiply the column matrix by the selected row matrix and return the resulting value. The column must be the same size as a row (getNumColumns) in the matrix.
|
|
bool | operator!= (const ms_matrix &m) const |
| Compare two matrices; size and all values.
|
|
ms_matrix | operator* (const ms_matrix &m) const |
| Multiply two matrices to produce a product matrix.
|
|
bool | operator== (const ms_matrix &m) const |
| Compare two matrices.
|
|
column_vector_t & | operator[] (size_t i) |
| Get a single column as a vector.
|
|
const column_vector_t & | operator[] (size_t i) const |
| Get a single column as a constant vector.
|
|
void | resize (size_t si, size_t sj, double v=0.0) |
| Change the size of the matrix, growing or shrinking as required. If grown then the data will be retained.
|
|
void | setColumnDown (size_t row, size_t col, const std::vector< double > &vec) |
| Copies the values in the passed vector into the column specified, starting at the passed row.
|
|
void | setColumnUp (size_t row, size_t col, const std::vector< double > &vec) |
| Copies the values in the passed vector into the column specified, starting at the passed row.
|
|
void | setCR (size_t i, size_t j, double value) |
| Set the value for the specified row and column.
|
|
void | setRC (size_t i, size_t j, double value) |
| Set the value for the specified row and column.
|
|
size_t | sizei () const |
| Return the number of columns in the matrix.
|
|
size_t | sizej () const |
| Return the number of rows in the matrix.
|
|
void | transpose () |
| Transpose the matrix in place.
|
|
A two-dimensional matrix of numbers.
The size of a matrix is defined by the number of rows and columns that it contains.
The entry in the j-th row and i-th column of a matrix A is accessed as A[i][j]. Note that this is the opposite of the conventional mathematical notation, where the j-th row of the i-th column of a matrix A is referred to as A[j,i].
The row and column indexes are zero-based (0 to n-1). Note that this differs from the conventional mathematical notation where indexes are one-based (1 to n).
Multiply two matrices to produce a product matrix.
The number of columns in the left-hand matrix must equal the number of rows in the right hand matrix.
The product matrix has a number of rows equal to the number of rows in the left-hand matrix and a number of columns equal to the number of columns in the right-hand matrix.
For example, a 2x3 matrix A can be mutlipled by a 4x2 matrix B, C=A*B, to produce a 4x3 matrix.but not the other way around, C=B*A.) (e.g. a 2x3 matrix multiplied by a 4x2 matrix would have a size of 4x3.)
- Parameters
-
- Returns
- new object of type ms_matrix
void setColumnDown |
( |
size_t |
row, |
|
|
size_t |
col, |
|
|
const std::vector< double > & |
vec |
|
) |
| |
Copies the values in the passed vector into the column specified, starting at the passed row.
The first value in vec is copied into row, col
The second value in vec is copied into row+1, col
etc.
If vec is larger than the size of the matrix, then the copying stops at the final row in the matrix.
- Parameters
-
row | is the zero based row to start copying |
col | is the column to be filled with values |
vec | contains the values to be copied |
void setColumnUp |
( |
size_t |
row, |
|
|
size_t |
col, |
|
|
const std::vector< double > & |
vec |
|
) |
| |
Copies the values in the passed vector into the column specified, starting at the passed row.
The last value in vec is copied into row, col
The second last value in vec is copied into row-1, col
etc.
If vec is larger than the size of the matrix, then the copying stops at the first row in the matrix.
- Parameters
-
row | is the zero based row to start copying |
col | is the column to be filled with values |
vec | contains the values to be copied |