From 506cc5db12bdfa375d630d85d2fde12bdfe1d1ec Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 7 Sep 2007 09:47:13 +0000 Subject: remove operator *= between matrices: too much hassle. --- doc/tutorial.cpp | 7 ------- src/MatrixBase.h | 12 ++++-------- src/MatrixOps.h | 18 ------------------ src/MatrixXpr.h | 2 -- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/doc/tutorial.cpp b/doc/tutorial.cpp index 51847460f..330fcf326 100644 --- a/doc/tutorial.cpp +++ b/doc/tutorial.cpp @@ -49,12 +49,5 @@ int main(int, char **) m = m_save; m.alias() = m * m; cout << "And m is now:" << endl << m << endl << "as was expected." << endl; - cout << "To make your life easier, operator*= between matrices automatically" << endl - << "creates an alias. So a *= b is equivalent to a.alias() *= b," << endl - << "when a and b are matrices. So, coming back to the original matrix m," << endl - << "if we do m *= m, the matrix m becomes:" << endl; - m = m_save; - m *= m; - cout << m << endl << "as expected." << endl; return 0; } diff --git a/src/MatrixBase.h b/src/MatrixBase.h index ab86f3289..e21887df6 100644 --- a/src/MatrixBase.h +++ b/src/MatrixBase.h @@ -206,14 +206,10 @@ class MatrixBase MatrixBase& operator+=(const MatrixConstXpr &xpr); template MatrixBase& operator-=(const MatrixConstXpr &xpr); - template - MatrixBase& operator*=(const MatrixConstXpr &xpr); template MatrixBase& operator+=(const MatrixBase &other); template MatrixBase& operator-=(const MatrixBase &other); - template - MatrixBase& operator*=(const MatrixBase &other); protected: @@ -269,12 +265,12 @@ template class MatrixAlias typedef MatrixRef > Ref; typedef MatrixXpr Xpr; - MatrixAlias(Derived& matrix) : m_ref(matrix), m_tmp(matrix) {} - MatrixAlias(const MatrixAlias& other) : m_ref(other.m_ref), m_tmp(other.m_tmp) {} + MatrixAlias(Derived& matrix) : m_aliased(matrix), m_tmp(matrix) {} + MatrixAlias(const MatrixAlias& other) : m_aliased(other.m_aliased), m_tmp(other.m_tmp) {} ~MatrixAlias() { - m_ref.xpr() = m_tmp; + m_aliased.xpr() = m_tmp; } Xpr xpr() @@ -324,7 +320,7 @@ template class MatrixAlias } protected: - MatrixRef > m_ref; + MatrixRef > m_aliased; Derived m_tmp; }; diff --git a/src/MatrixOps.h b/src/MatrixOps.h index 8c2d5cda3..67e10d9d7 100644 --- a/src/MatrixOps.h +++ b/src/MatrixOps.h @@ -213,24 +213,6 @@ EIGEN_MAKE_MATRIX_OP_EQ(-) #undef EIGEN_MAKE_MATRIX_OP_EQ -template -template -MatrixBase & -MatrixBase::operator *=(const MatrixBase &mat2) -{ - alias() = *this * mat2; - return *this; -} - -template -template -MatrixBase & -MatrixBase::operator *=(const MatrixConstXpr &xpr) -{ - alias() = *this * xpr; - return *this; -} - } // namespace Eigen #endif // EIGEN_MATRIXOPS_H diff --git a/src/MatrixXpr.h b/src/MatrixXpr.h index 843cb214d..5caf365ed 100644 --- a/src/MatrixXpr.h +++ b/src/MatrixXpr.h @@ -123,8 +123,6 @@ template class MatrixXpr MatrixXpr& operator+=(const MatrixBase &matrix); template MatrixXpr& operator-=(const MatrixBase &matrix); - - private: void operator=(const MatrixXpr &other) -- cgit v1.2.3