add a missing operator= for copying a matrix into an expression.

This commit is contained in:
Benoit Jacob 2007-09-05 11:39:42 +00:00
parent 13a82795f7
commit 9477e62b68
3 changed files with 14 additions and 1 deletions

View File

@ -211,6 +211,16 @@ class MatrixBase
MatrixBase() {}; MatrixBase() {};
}; };
template<typename Content>
template<typename Derived>
void MatrixXpr<Content>::operator=(const MatrixBase<Derived>& 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<typename Derived> template<typename Derived>
std::ostream & operator << std::ostream & operator <<
( std::ostream & s, ( std::ostream & s,

View File

@ -105,6 +105,9 @@ template<typename Content> class MatrixXpr
this->operator()(i, j) = other(i, j); this->operator()(i, j) = other(i, j);
} }
template<typename Derived>
void operator=(const MatrixBase<Derived>& matrix);
MatrixXpr<MatrixRow<MatrixXpr<Content> > > row(int i); MatrixXpr<MatrixRow<MatrixXpr<Content> > > row(int i);
MatrixXpr<MatrixCol<MatrixXpr<Content> > > col(int i); MatrixXpr<MatrixCol<MatrixXpr<Content> > > col(int i);
MatrixXpr<MatrixMinor<MatrixXpr<Content> > > minor(int row, int col); MatrixXpr<MatrixMinor<MatrixXpr<Content> > > minor(int row, int col);