diff --git a/CMakeLists.txt b/CMakeLists.txt index bfc5a1382..a45fff6a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,4 +15,4 @@ endif (CMAKE_COMPILER_IS_GNUCXX) include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) add_subdirectory(src) -add_subdirectory(test) \ No newline at end of file +add_subdirectory(test) diff --git a/src/MatrixBase.h b/src/MatrixBase.h index 8e2be915b..bcc747aca 100644 --- a/src/MatrixBase.h +++ b/src/MatrixBase.h @@ -211,6 +211,16 @@ class MatrixBase MatrixBase() {}; }; +template +template +void MatrixXpr::operator=(const MatrixBase& matrix) +{ + assert(rows() == matrix.rows() && cols() == matrix.cols()); + for(int i = 0; i < rows(); i++) + for(int j = 0; j < cols(); j++) + this->operator()(i, j) = matrix(i, j); +} + template std::ostream & operator << ( std::ostream & s, diff --git a/src/MatrixXpr.h b/src/MatrixXpr.h index 0b23f88bf..9a1ab1085 100644 --- a/src/MatrixXpr.h +++ b/src/MatrixXpr.h @@ -105,6 +105,9 @@ template class MatrixXpr this->operator()(i, j) = other(i, j); } + template + void operator=(const MatrixBase& matrix); + MatrixXpr > > row(int i); MatrixXpr > > col(int i); MatrixXpr > > minor(int row, int col);