#include <yat/utility/Matrix.h>
Public Types | |
typedef double | value_type |
typedef double & | reference |
typedef const double & | const_reference |
typedef StrideIterator< double * > | iterator |
typedef StrideIterator< const double * > | const_iterator |
typedef StrideIterator< double * > | column_iterator |
typedef StrideIterator< const double * > | const_column_iterator |
typedef StrideIterator< double * > | row_iterator |
typedef StrideIterator< const double * > | const_row_iterator |
Public Member Functions | |
Matrix (void) | |
The default constructor. | |
Matrix (const size_t &r, const size_t &c, double init_value=0) | |
Constructor allocating memory space for r times c elements, and sets all elements to init_value. | |
Matrix (const Matrix &) | |
The copy constructor. | |
Matrix (std::istream &, char sep='\0') throw (utility::IO_error, std::exception) | |
The istream constructor. | |
~Matrix (void) | |
The destructor. | |
void | all (const double value) |
iterator | begin (void) |
const_iterator | begin (void) const |
iterator | begin_column (size_t i) |
const_iterator | begin_column (size_t i) const |
iterator | begin_row (size_t i) |
const_iterator | begin_row (size_t i) const |
VectorView | column_view (size_t i) |
const VectorConstView | column_const_view (size_t) const |
size_t | columns (void) const |
void | div (const Matrix &b) |
iterator | end (void) |
const_iterator | end (void) const |
iterator | end_column (size_t i) |
const_iterator | end_column (size_t i) const |
iterator | end_row (size_t i) |
const_iterator | end_row (size_t i) const |
bool | equal (const Matrix &, const double precision=0) const |
Check whether matrices are equal within a user defined precision, set by precision. | |
const gsl_matrix * | gsl_matrix_p (void) const |
gsl_matrix * | gsl_matrix_p (void) |
void | mul (const Matrix &b) |
void | resize (size_t, size_t, double init_value=0) |
Resize Matrix. | |
size_t | rows (void) const |
VectorView | row_view (size_t) |
const VectorConstView | row_const_view (size_t) const |
void | swap_columns (const size_t i, const size_t j) |
Swap columns i and j. | |
void | swap_rowcol (const size_t i, const size_t j) |
Swap row i and column j. | |
void | swap_rows (const size_t i, const size_t j) |
Swap rows i and j. | |
void | transpose (void) |
Transpose the matrix. | |
double & | operator() (size_t row, size_t column) |
Element access operator. | |
const double & | operator() (size_t row, size_t column) const |
Element access operator. | |
bool | operator== (const Matrix &other) const |
Comparison operator. Takes squared time. | |
bool | operator!= (const Matrix &other) const |
Comparison operator. Takes squared time. | |
const Matrix & | operator= (const Matrix &other) |
The assignment operator. | |
const Matrix & | operator+= (const Matrix &b) |
Add and assign operator. | |
const Matrix & | operator+= (const double d) |
Add and assign operator. | |
const Matrix & | operator-= (const Matrix &) |
Subtract and assign operator. | |
const Matrix & | operator-= (const double d) |
Subtract and assign operator. | |
const Matrix & | operator*= (const Matrix &) |
Multiply and assignment operator. | |
const Matrix & | operator*= (double d) |
Multiply and assignment operator. |
For the time being 'double' is the only type supported.
typedef double theplu::yat::utility::Matrix::value_type |
typedef double& theplu::yat::utility::Matrix::reference |
typedef const double& theplu::yat::utility::Matrix::const_reference |
typedef StrideIterator<double*> theplu::yat::utility::Matrix::iterator |
Mutable iterator that iterates over all elements
typedef StrideIterator<const double*> theplu::yat::utility::Matrix::const_iterator |
Read-only iterator that iterates over all elements
typedef StrideIterator<double*> theplu::yat::utility::Matrix::column_iterator |
Mutable iterator that iterates over one column
typedef StrideIterator<const double*> theplu::yat::utility::Matrix::const_column_iterator |
Read-only iterator that iterates over one column
typedef StrideIterator<double*> theplu::yat::utility::Matrix::row_iterator |
Mutable iterator that iterates over one row
typedef StrideIterator<const double*> theplu::yat::utility::Matrix::const_row_iterator |
Read-only iterator that iterates over one row
theplu::yat::utility::Matrix::Matrix | ( | void | ) |
The default constructor.
This constructor does not initialize underlying (essential) structures.
theplu::yat::utility::Matrix::Matrix | ( | const size_t & | r, | |
const size_t & | c, | |||
double | init_value = 0 | |||
) |
Constructor allocating memory space for r times c elements, and sets all elements to init_value.
GSL_error | if memory allocation fails. |
theplu::yat::utility::Matrix::Matrix | ( | const Matrix & | ) |
theplu::yat::utility::Matrix::Matrix | ( | std::istream & | , | |
char | sep = '\0' | |||
) | throw (utility::IO_error, std::exception) [explicit] |
The istream constructor.
The std::istream will be interpreted as outlined here:
Missing values, i.e. empty elements, are treated as NaN values (std::numeric_limits<double>::quiet_NaN() to be specific).
Matrix rows are separated with the new line character.
Column element separation has two modes depending on the value of sep.
End of input is the end of file marker and this treatment cannot be redefined using the provided API.
void theplu::yat::utility::Matrix::all | ( | const double | value | ) |
Set all elements to value.
iterator theplu::yat::utility::Matrix::begin | ( | void | ) |
Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.
const_iterator theplu::yat::utility::Matrix::begin | ( | void | ) | const |
Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.
iterator theplu::yat::utility::Matrix::begin_column | ( | size_t | i | ) |
Iterator iterates along a column.
const_iterator theplu::yat::utility::Matrix::begin_column | ( | size_t | i | ) | const |
Iterator iterates along a column.
iterator theplu::yat::utility::Matrix::begin_row | ( | size_t | i | ) |
Iterator iterates along a row.
const_iterator theplu::yat::utility::Matrix::begin_row | ( | size_t | i | ) | const |
Iterator iterates along a row.
VectorView theplu::yat::utility::Matrix::column_view | ( | size_t | i | ) |
const VectorConstView theplu::yat::utility::Matrix::column_const_view | ( | size_t | ) | const |
size_t theplu::yat::utility::Matrix::columns | ( | void | ) | const |
void theplu::yat::utility::Matrix::div | ( | const Matrix & | b | ) |
Elementwise division of the elements of the calling matrix by the elements of matrix b, . The result is stored into the calling matrix.
GSL_error | if dimensions mismatch. |
iterator theplu::yat::utility::Matrix::end | ( | void | ) |
const_iterator theplu::yat::utility::Matrix::end | ( | void | ) | const |
iterator theplu::yat::utility::Matrix::end_column | ( | size_t | i | ) |
const_iterator theplu::yat::utility::Matrix::end_column | ( | size_t | i | ) | const |
iterator theplu::yat::utility::Matrix::end_row | ( | size_t | i | ) |
const_iterator theplu::yat::utility::Matrix::end_row | ( | size_t | i | ) | const |
bool theplu::yat::utility::Matrix::equal | ( | const Matrix & | , | |
const double | precision = 0 | |||
) | const |
Check whether matrices are equal within a user defined precision, set by precision.
const gsl_matrix* theplu::yat::utility::Matrix::gsl_matrix_p | ( | void | ) | const |
gsl_matrix* theplu::yat::utility::Matrix::gsl_matrix_p | ( | void | ) |
void theplu::yat::utility::Matrix::mul | ( | const Matrix & | b | ) |
void theplu::yat::utility::Matrix::resize | ( | size_t | , | |
size_t | , | |||
double | init_value = 0 | |||
) |
size_t theplu::yat::utility::Matrix::rows | ( | void | ) | const |
VectorView theplu::yat::utility::Matrix::row_view | ( | size_t | ) |
const VectorConstView theplu::yat::utility::Matrix::row_const_view | ( | size_t | ) | const |
void theplu::yat::utility::Matrix::swap_columns | ( | const size_t | i, | |
const size_t | j | |||
) |
void theplu::yat::utility::Matrix::swap_rowcol | ( | const size_t | i, | |
const size_t | j | |||
) |
void theplu::yat::utility::Matrix::swap_rows | ( | const size_t | i, | |
const size_t | j | |||
) |
void theplu::yat::utility::Matrix::transpose | ( | void | ) |
Transpose the matrix.
GSL_error | if memory allocation fails for the new transposed matrix. |
double& theplu::yat::utility::Matrix::operator() | ( | size_t | row, | |
size_t | column | |||
) |
Element access operator.
If | GSL range checks are enabled in the underlying GSL library a GSL_error exception is thrown if either index is out of range. |
const double& theplu::yat::utility::Matrix::operator() | ( | size_t | row, | |
size_t | column | |||
) | const |
Element access operator.
If | GSL range checks are enabled in the underlying GSL library a GSL_error exception is thrown if either index is out of range. |
bool theplu::yat::utility::Matrix::operator== | ( | const Matrix & | other | ) | const |
Comparison operator. Takes squared time.
Checks are performed with exact matching, i.e., rounding off effects may destroy comparison. Use the equal function for comparing elements within a user defined precision.
bool theplu::yat::utility::Matrix::operator!= | ( | const Matrix & | other | ) | const |
Comparison operator. Takes squared time.
Checks are performed with exact matching, i.e., rounding off effects may destroy comparison. Use the equal function for comparing elements within a user defined precision.
const Matrix& theplu::yat::utility::Matrix::operator+= | ( | const double | d | ) |
Add and assign operator.
Add the scalar value d to the left hand side Matrix, .
const Matrix& theplu::yat::utility::Matrix::operator-= | ( | const double | d | ) |
Subtract and assign operator.
Subtract the scalar value d to the left hand side Matrix, .
const Matrix& theplu::yat::utility::Matrix::operator*= | ( | double | d | ) |