GEDLIB
1.0
|
A matrix class with basic functionality. More...
#include <matrix.hpp>
Public Member Functions | |
Matrix () | |
Constructs an empty cost matrix. | |
Matrix (std::size_t num_rows, std::size_t num_cols, ScalarT val=0) | |
Constructs a matrix of given size with default entries. More... | |
Matrix (const Matrix &matrix) | |
Copy constructor. More... | |
void | operator= (const Matrix &matrix) |
Assignment operator. More... | |
void | swap (Matrix &matrix) |
Swaps the matrix with another matrix. More... | |
const ScalarT & | operator() (std::size_t row, std::size_t col) const |
Provides access to a cell. More... | |
ScalarT & | operator() (std::size_t row, std::size_t col) |
Provides access to a cell. More... | |
ScalarT * | data () |
Provides access to internal data. More... | |
const ScalarT * | data () const |
Provides constant access to internal data. More... | |
std::size_t | num_rows () const |
Returns the number of rows. More... | |
std::size_t | num_cols () const |
Returns the number of columns. More... | |
void | resize (std::size_t num_rows, std::size_t num_cols) |
Resizes the matrix. More... | |
void | set_to_val (const ScalarT &val) |
Sets all cells to val . | |
void | power (std::size_t n) |
Takes the matrix to the power of n . | |
ScalarT | max () const |
Returns the maximal coefficient. | |
ScalarT | min () const |
Returns the minimal coefficient. | |
void | transpose () |
Transposes the matrix. | |
Matrix< ScalarT > | transposed () const |
Returns the transposed matrix. | |
Matrix< ScalarT > & | operator*= (const ScalarT &scalar) |
Matrix-scalar multiplication assignment. | |
Matrix< ScalarT > & | operator+= (const Matrix< ScalarT > &matrix) |
Matrix-matrix addition assignment. | |
Matrix< ScalarT > & | operator-= (const Matrix< ScalarT > &matrix) |
Matrix-matrix substraction assignment. | |
Matrix< ScalarT > | operator* (const ScalarT &scalar) const |
Matrix-scalar multiplication. | |
Matrix< ScalarT > | operator+ (const Matrix< ScalarT > &matrix) const |
Matrix-matrix addition. | |
Matrix< ScalarT > | operator- (const Matrix< ScalarT > &matrix) const |
Matrix-matrix addition. | |
Eigen::Matrix< ScalarT, Eigen::Dynamic, Eigen::Dynamic > & | matrix () |
Returns reference to the internal Eigen matrix. | |
const Eigen::Matrix< ScalarT, Eigen::Dynamic, Eigen::Dynamic > & | matrix () const |
Returns constant reference to the internal Eigen matrix. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename ScalarT > | |
std::ostream & | operator<< (std::ostream &os, const Matrix< ScalarT > &matrix) |
Streams a matrix. More... | |
A matrix class with basic functionality.
Definition at line 38 of file matrix.hpp.
ged::Matrix< ScalarT >::Matrix | ( | std::size_t | num_rows, |
std::size_t | num_cols, | ||
ScalarT | val = 0 |
||
) |
Constructs a matrix of given size with default entries.
[in] | num_rows | The number of rows. |
[in] | num_cols | The number of columns. |
[in] | val | The default value of all cells. |
Definition at line 34 of file matrix.ipp.
ged::Matrix< ScalarT >::Matrix | ( | const Matrix< ScalarT > & | matrix | ) |
Copy constructor.
[in] | matrix | Matrix that should be copied. |
Definition at line 44 of file matrix.ipp.
ScalarT * ged::Matrix< ScalarT >::data | ( | ) |
Provides access to internal data.
Definition at line 71 of file matrix.ipp.
const ScalarT * ged::Matrix< ScalarT >::data | ( | ) | const |
Provides constant access to internal data.
Definition at line 78 of file matrix.ipp.
std::size_t ged::Matrix< ScalarT >::num_cols | ( | ) | const |
Returns the number of columns.
Definition at line 110 of file matrix.ipp.
std::size_t ged::Matrix< ScalarT >::num_rows | ( | ) | const |
const ScalarT & ged::Matrix< ScalarT >::operator() | ( | std::size_t | row, |
std::size_t | col | ||
) | const |
Provides access to a cell.
[in] | row | Row of the cell. |
[in] | col | Column of the cell. |
row
,col
). Definition at line 57 of file matrix.ipp.
ScalarT & ged::Matrix< ScalarT >::operator() | ( | std::size_t | row, |
std::size_t | col | ||
) |
Provides access to a cell.
[in] | row | Row of the cell. |
[in] | col | Column of the cell. |
row
,col
). Definition at line 64 of file matrix.ipp.
void ged::Matrix< ScalarT >::operator= | ( | const Matrix< ScalarT > & | matrix | ) |
Assignment operator.
[in] | matrix | Matrix that should be assigned. |
Definition at line 50 of file matrix.ipp.
void ged::Matrix< ScalarT >::resize | ( | std::size_t | num_rows, |
std::size_t | num_cols | ||
) |
Resizes the matrix.
[in] | num_rows | New number of rows. |
[in] | num_cols | New number of columns. |
Definition at line 92 of file matrix.ipp.
void ged::Matrix< ScalarT >::swap | ( | Matrix< ScalarT > & | matrix | ) |
Swaps the matrix with another matrix.
[in,out] | matrix | Matrix that is to be swapped with the calling matrix. |
Definition at line 156 of file matrix.ipp.
|
related |
Streams a matrix.
[in,out] | os | Output stream. |
[in] | matrix | The matrix that should be streamed. |
os
. Definition at line 240 of file matrix.ipp.