| 1345 | |
| 1346 | template<typename _Matrix> |
| 1347 | class MatrixInplaceAssignment |
| 1348 | { |
| 1349 | private: |
| 1350 | _Matrix * matrix_; |
| 1351 | public: |
| 1352 | MatrixInplaceAssignment(_Matrix* matrix) : matrix_(matrix) {} |
| 1353 | |
| 1354 | /** |
| 1355 | * \brief Evaluates the expression inline inplace into the current matrix. |
| 1356 | * No new memory is created, it is reused! |
| 1357 | * This operator fails with an exception if the dimensions don't match. |
| 1358 | * \param expr the other expression |
| 1359 | * \return the underlying matrix |
| 1360 | */ |
| 1361 | template<typename Derived> |
| 1362 | CUMAT_STRONG_INLINE _Matrix& operator=(const MatrixBase<Derived>& expr) |
| 1363 | { |
| 1364 | CUMAT_ASSERT_DIMENSION(matrix_->rows() == expr.rows()); |
| 1365 | CUMAT_ASSERT_DIMENSION(matrix_->cols() == expr.cols()); |
| 1366 | CUMAT_ASSERT_DIMENSION(matrix_->batches() == expr.batches()); |
| 1367 | Assignment<_Matrix, Derived, AssignmentMode::ASSIGN, DenseDstTag, typename Derived::SrcTag>::assign(*matrix_, expr.derived()); |
| 1368 | return *matrix_; |
| 1369 | } |
| 1370 | }; |
| 1371 | } |
| 1372 | |
| 1373 | //Common typedefs |