diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-09-27 19:38:40 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-09-27 19:38:40 +0000 |
commit | 5160e9d0292b7ebf39376803c5b7764f0f838714 (patch) | |
tree | f4c59929c888c4a0a18529f22e9c326947bf276b | |
parent | 4e299afb1f1f19f470920f63b39c5a91be138788 (diff) |
Half-way commit prefixing object names. I am forced to commit now
because I renamed a file once with a wrong filename and svn refuses to
let me rename it again, tells me i should propagate first.
-rw-r--r-- | doc/tutorial.cpp | 2 | ||||
-rw-r--r-- | src/internal/Block.h | 24 | ||||
-rw-r--r-- | src/internal/EiObject.h (renamed from src/internal/EigenBase.h) | 22 | ||||
-rw-r--r-- | src/internal/Matrix.h | 16 | ||||
-rw-r--r-- | src/internal/MatrixOps.h | 36 | ||||
-rw-r--r-- | src/internal/MatrixRef.h | 6 | ||||
-rw-r--r-- | src/internal/MatrixStorage.h | 6 | ||||
-rw-r--r-- | src/internal/Minor.h | 14 | ||||
-rw-r--r-- | src/internal/RowAndCol.h | 28 | ||||
-rw-r--r-- | src/internal/ScalarOps.h | 18 | ||||
-rw-r--r-- | src/internal/Util.h | 43 | ||||
-rw-r--r-- | test/matrixmanip.cpp | 6 | ||||
-rw-r--r-- | test/matrixops.cpp | 12 |
13 files changed, 114 insertions, 119 deletions
diff --git a/doc/tutorial.cpp b/doc/tutorial.cpp index 2eec7be3e..38943ec50 100644 --- a/doc/tutorial.cpp +++ b/doc/tutorial.cpp @@ -12,7 +12,7 @@ int main(int, char **) cout << "Here is a 2x2 matrix m:" << endl << m << endl; cout << "Let us now build a 4x4 matrix m2 by assembling together four 2x2 blocks." << endl; - MatrixXd m2(4,4); // dynamic matrix with initial size 4x4 and uninitialized entries + EiMatrixXd m2(4,4); // dynamic matrix with initial size 4x4 and uninitialized entries // notice how we are mixing fixed-size and dynamic-size types. cout << "In the top-left block, we put the matrix m shown above." << endl; diff --git a/src/internal/Block.h b/src/internal/Block.h index 72181abb7..93ddddcb7 100644 --- a/src/internal/Block.h +++ b/src/internal/Block.h @@ -26,19 +26,19 @@ #ifndef EIGEN_BLOCK_H #define EIGEN_BLOCK_H -template<typename MatrixType> class MatrixBlock - : public EigenBase<typename MatrixType::Scalar, MatrixBlock<MatrixType> > +template<typename MatrixType> class EiBlock + : public EiObject<typename MatrixType::Scalar, EiBlock<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EigenBase<Scalar, MatrixBlock<MatrixType> >; - typedef MatrixBlock Ref; + friend class EiObject<Scalar, EiBlock<MatrixType> >; + typedef EiBlock Ref; - static const int RowsAtCompileTime = DynamicSize, - ColsAtCompileTime = DynamicSize; + static const int RowsAtCompileTime = EiDynamic, + ColsAtCompileTime = EiDynamic; - MatrixBlock(const MatRef& matrix, + EiBlock(const MatRef& matrix, int startRow, int endRow, int startCol = 0, int endCol = 0) : m_matrix(matrix), m_startRow(startRow), m_endRow(endRow), @@ -48,11 +48,11 @@ template<typename MatrixType> class MatrixBlock && startCol >= 0 && startCol <= endCol && endCol < matrix.cols()); } - MatrixBlock(const MatrixBlock& other) + EiBlock(const EiBlock& other) : m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow), m_startCol(other.m_startCol), m_endCol(other.m_endCol) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixBlock) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(EiBlock) private: const Ref& _ref() const { return *this; } @@ -75,10 +75,10 @@ template<typename MatrixType> class MatrixBlock }; template<typename Scalar, typename Derived> -MatrixBlock<EigenBase<Scalar, Derived> > -EigenBase<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol) +EiBlock<EiObject<Scalar, Derived> > +EiObject<Scalar, Derived>::block(int startRow, int endRow, int startCol, int endCol) { - return MatrixBlock<EigenBase>(ref(), startRow, endRow, startCol, endCol); + return EiBlock<EiObject>(ref(), startRow, endRow, startCol, endCol); } #endif // EIGEN_BLOCK_H diff --git a/src/internal/EigenBase.h b/src/internal/EiObject.h index ad39df599..290d60b15 100644 --- a/src/internal/EigenBase.h +++ b/src/internal/EiObject.h @@ -28,7 +28,7 @@ #include "Util.h" -template<typename _Scalar, typename Derived> class EigenBase +template<typename _Scalar, typename Derived> class EiObject { static const int RowsAtCompileTime = Derived::RowsAtCompileTime, ColsAtCompileTime = Derived::ColsAtCompileTime; @@ -57,7 +57,7 @@ template<typename _Scalar, typename Derived> class EigenBase } template<typename OtherDerived> - Derived& operator=(const EigenBase<Scalar, OtherDerived>& other) + Derived& operator=(const EiObject<Scalar, OtherDerived>& other) { assert(rows() == other.rows() && cols() == other.cols()); for(int i = 0; i < rows(); i++) @@ -68,7 +68,7 @@ template<typename _Scalar, typename Derived> class EigenBase //special case of the above template operator=. Strangely, g++ 4.1 failed to use //that template when OtherDerived == Derived - Derived& operator=(const EigenBase& other) + Derived& operator=(const EiObject& other) { assert(rows() == other.rows() && cols() == other.cols()); for(int i = 0; i < rows(); i++) @@ -77,18 +77,18 @@ template<typename _Scalar, typename Derived> class EigenBase return *static_cast<Derived*>(this); } - MatrixRow<EigenBase> row(int i); - MatrixCol<EigenBase> col(int i); - MatrixMinor<EigenBase> minor(int row, int col); - MatrixBlock<EigenBase> + MatrixRow<EiObject> row(int i); + MatrixCol<EiObject> col(int i); + MatrixMinor<EiObject> minor(int row, int col); + EiBlock<EiObject> block(int startRow, int endRow, int startCol= 0, int endCol = 0); template<typename OtherDerived> - Derived& operator+=(const EigenBase<Scalar, OtherDerived>& other); + Derived& operator+=(const EiObject<Scalar, OtherDerived>& other); template<typename OtherDerived> - Derived& operator-=(const EigenBase<Scalar, OtherDerived>& other); + Derived& operator-=(const EiObject<Scalar, OtherDerived>& other); template<typename OtherDerived> - Derived& operator*=(const EigenBase<Scalar, OtherDerived>& other); + Derived& operator*=(const EiObject<Scalar, OtherDerived>& other); Derived& operator*=(const int& other); Derived& operator*=(const float& other); @@ -114,7 +114,7 @@ template<typename _Scalar, typename Derived> class EigenBase template<typename Scalar, typename Derived> std::ostream & operator << ( std::ostream & s, - const EigenBase<Scalar, Derived> & m ) + const EiObject<Scalar, Derived> & m ) { for( int i = 0; i < m.rows(); i++ ) { diff --git a/src/internal/Matrix.h b/src/internal/Matrix.h index af397c2eb..00780ae43 100644 --- a/src/internal/Matrix.h +++ b/src/internal/Matrix.h @@ -27,17 +27,17 @@ #define EIGEN_MATRIX_H #include "Util.h" -#include "EigenBase.h" +#include "EiObject.h" #include "MatrixRef.h" #include "MatrixStorage.h" template<typename _Scalar, int _Rows, int _Cols> -class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, +class EiMatrix : public EiObject<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, public MatrixStorage<_Scalar, _Rows, _Cols> { public: - friend class EigenBase<_Scalar, Matrix>; - typedef EigenBase<_Scalar, Matrix> Base; + friend class EiObject<_Scalar, Matrix>; + typedef EiObject<_Scalar, Matrix> Base; typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage; typedef _Scalar Scalar; typedef MatrixRef<Matrix> Ref; @@ -70,7 +70,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, public: template<typename OtherDerived> - Matrix& operator=(const EigenBase<Scalar, OtherDerived>& other) + Matrix& operator=(const EiObject<Scalar, OtherDerived>& other) { resize(other.rows(), other.cols()); return Base::operator=(other); @@ -88,7 +88,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} template<typename OtherDerived> - Matrix(const EigenBase<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols()) + Matrix(const EiObject<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols()) { *this = other; } @@ -101,7 +101,7 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, template<typename Scalar, typename Derived> Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> -eval(const EigenBase<Scalar, Derived>& expression) +eval(const EiObject<Scalar, Derived>& expression) { return Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression); } @@ -114,7 +114,7 @@ typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ -EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, DynamicSize, X) +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, EiDynamic, X) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) diff --git a/src/internal/MatrixOps.h b/src/internal/MatrixOps.h index eda1b58b4..4f28c179a 100644 --- a/src/internal/MatrixOps.h +++ b/src/internal/MatrixOps.h @@ -26,15 +26,15 @@ #ifndef EIGEN_MATRIXOPS_H #define EIGEN_MATRIXOPS_H -template<typename Lhs, typename Rhs> class MatrixSum - : public EigenBase<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> > +template<typename Lhs, typename Rhs> class EiSum + : public EiObject<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; - friend class EigenBase<Scalar, MatrixSum>; - typedef MatrixSum Ref; + friend class EiObject<Scalar, MatrixSum>; + typedef EiSum Ref; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; @@ -66,15 +66,15 @@ template<typename Lhs, typename Rhs> class MatrixSum const RhsRef m_rhs; }; -template<typename Lhs, typename Rhs> class MatrixDifference - : public EigenBase<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> > +template<typename Lhs, typename Rhs> class EiDifference + : public EiObject<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; - friend class EigenBase<Scalar, MatrixDifference>; - typedef MatrixDifference Ref; + friend class EiObject<Scalar, MatrixDifference>; + typedef EiDifference Ref; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; @@ -105,15 +105,15 @@ template<typename Lhs, typename Rhs> class MatrixDifference const RhsRef m_rhs; }; -template<typename Lhs, typename Rhs> class MatrixProduct - : public EigenBase<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> > +template<typename Lhs, typename Rhs> class EiMatrixProduct + : public EiObject<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; - friend class EigenBase<Scalar, MatrixProduct>; - typedef MatrixProduct Ref; + friend class EiObject<Scalar, MatrixProduct>; + typedef EiMatrixProduct Ref; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; @@ -149,21 +149,21 @@ template<typename Lhs, typename Rhs> class MatrixProduct template<typename Scalar, typename Derived1, typename Derived2> MatrixSum<Derived1, Derived2> -operator+(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2) +operator+(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2) { return MatrixSum<Derived1, Derived2>(mat1.ref(), mat2.ref()); } template<typename Scalar, typename Derived1, typename Derived2> MatrixDifference<Derived1, Derived2> -operator-(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2) +operator-(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2) { return MatrixDifference<Derived1, Derived2>(mat1.ref(), mat2.ref()); } template<typename Scalar, typename Derived1, typename Derived2> MatrixProduct<Derived1, Derived2> -operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2) +operator*(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2) { return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref()); } @@ -171,7 +171,7 @@ operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Deriv template<typename Scalar, typename Derived> template<typename OtherDerived> Derived & -EigenBase<Scalar, Derived>::operator+=(const EigenBase<Scalar, OtherDerived>& other) +EiObject<Scalar, Derived>::operator+=(const EiObject<Scalar, OtherDerived>& other) { *this = *this + other; return *static_cast<Derived*>(this); @@ -180,7 +180,7 @@ EigenBase<Scalar, Derived>::operator+=(const EigenBase<Scalar, OtherDerived>& ot template<typename Scalar, typename Derived> template<typename OtherDerived> Derived & -EigenBase<Scalar, Derived>::operator-=(const EigenBase<Scalar, OtherDerived> &other) +EiObject<Scalar, Derived>::operator-=(const EiObject<Scalar, OtherDerived> &other) { *this = *this - other; return *static_cast<Derived*>(this); @@ -189,7 +189,7 @@ EigenBase<Scalar, Derived>::operator-=(const EigenBase<Scalar, OtherDerived> &ot template<typename Scalar, typename Derived> template<typename OtherDerived> Derived & -EigenBase<Scalar, Derived>::operator*=(const EigenBase<Scalar, OtherDerived> &other) +EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &other) { *this = *this * other; return *static_cast<Derived*>(this); diff --git a/src/internal/MatrixRef.h b/src/internal/MatrixRef.h index 8ee569001..2e999d6d3 100644 --- a/src/internal/MatrixRef.h +++ b/src/internal/MatrixRef.h @@ -26,12 +26,12 @@ #ifndef EIGEN_MATRIXREF_H #define EIGEN_MATRIXREF_H -template<typename MatrixType> class MatrixRef - : public EigenBase<typename MatrixType::Scalar, MatrixRef<MatrixType> > +template<typename MatrixType> class EiMatrixRef + : public EiObject<typename MatrixType::Scalar, MatrixRef<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; - friend class EigenBase<Scalar, MatrixRef>; + friend class EiObject<Scalar, MatrixRef>; MatrixRef(MatrixType& matrix) : m_matrix(matrix) {} MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {} diff --git a/src/internal/MatrixStorage.h b/src/internal/MatrixStorage.h index 45afcbe6a..9554bf961 100644 --- a/src/internal/MatrixStorage.h +++ b/src/internal/MatrixStorage.h @@ -29,7 +29,7 @@ template<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime> -class MatrixStorage +class EiMatrixStorage { protected: Scalar m_array[RowsAtCompileTime * RowsAtCompileTime]; @@ -55,7 +55,7 @@ class MatrixStorage }; template<typename Scalar> -class MatrixStorage<Scalar, DynamicSize, 1> +class MatrixStorage<Scalar, EiDynamic, 1> { protected: int m_rows; @@ -88,7 +88,7 @@ class MatrixStorage<Scalar, DynamicSize, 1> }; template<typename Scalar> -class MatrixStorage<Scalar, DynamicSize, DynamicSize> +class MatrixStorage<Scalar, EiDynamic, EiDynamic> { protected: int m_rows, m_cols; diff --git a/src/internal/Minor.h b/src/internal/Minor.h index 20aa7060f..cc6fa0b18 100644 --- a/src/internal/Minor.h +++ b/src/internal/Minor.h @@ -26,14 +26,14 @@ #ifndef EIGEN_MINOR_H #define EIGEN_MINOR_H -template<typename MatrixType> class MatrixMinor - : public EigenBase<typename MatrixType::Scalar, MatrixMinor<MatrixType> > +template<typename MatrixType> class EiMinor + : public EiObject<typename MatrixType::Scalar, MatrixMinor<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EigenBase<Scalar, MatrixMinor<MatrixType> >; - typedef MatrixMinor Ref; + friend class EiObject<Scalar, MatrixMinor<MatrixType> >; + typedef EiMinor Ref; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1, ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1; @@ -71,10 +71,10 @@ template<typename MatrixType> class MatrixMinor }; template<typename Scalar, typename Derived> -MatrixMinor<EigenBase<Scalar, Derived> > -EigenBase<Scalar, Derived>::minor(int row, int col) +MatrixMinor<EiObject<Scalar, Derived> > +EiObject<Scalar, Derived>::minor(int row, int col) { - return MatrixMinor<EigenBase>(ref(), row, col); + return MatrixMinor<EiObject>(ref(), row, col); } #endif // EIGEN_MINOR_H diff --git a/src/internal/RowAndCol.h b/src/internal/RowAndCol.h index 5b6e4ef07..03e25651f 100644 --- a/src/internal/RowAndCol.h +++ b/src/internal/RowAndCol.h @@ -26,14 +26,14 @@ #ifndef EIGEN_ROWANDCOL_H #define EIGEN_ROWANDCOL_H -template<typename MatrixType> class MatrixRow - : public EigenBase<typename MatrixType::Scalar, MatrixRow<MatrixType> > +template<typename MatrixType> class EiRow + : public EiObject<typename MatrixType::Scalar, MatrixRow<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EigenBase<Scalar, MatrixRow<MatrixType> >; - typedef MatrixRow Ref; + friend class EiObject<Scalar, MatrixRow<MatrixType> >; + typedef EiRow Ref; static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime, ColsAtCompileTime = 1; @@ -48,9 +48,9 @@ template<typename MatrixType> class MatrixRow : m_matrix(other.m_matrix), m_row(other.m_row) {} template<typename OtherDerived> - MatrixRow& operator=(const EigenBase<Scalar, OtherDerived>& other) + MatrixRow& operator=(const EiObject<Scalar, OtherDerived>& other) { - return EigenBase<Scalar, MatrixRow<MatrixType> >::operator=(other); + return EiObject<Scalar, MatrixRow<MatrixType> >::operator=(other); } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRow) @@ -81,12 +81,12 @@ template<typename MatrixType> class MatrixRow }; template<typename MatrixType> class MatrixCol - : public EigenBase<typename MatrixType::Scalar, MatrixCol<MatrixType> > + : public EiObject<typename MatrixType::Scalar, MatrixCol<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EigenBase<Scalar, MatrixCol<MatrixType> >; + friend class EiObject<Scalar, MatrixCol<MatrixType> >; typedef MatrixCol Ref; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, @@ -128,17 +128,17 @@ template<typename MatrixType> class MatrixCol }; template<typename Scalar, typename Derived> -MatrixRow<EigenBase<Scalar, Derived> > -EigenBase<Scalar, Derived>::row(int i) +MatrixRow<EiObject<Scalar, Derived> > +EiObject<Scalar, Derived>::row(int i) { - return MatrixRow<EigenBase>(ref(), i); + return MatrixRow<EiObject>(ref(), i); } template<typename Scalar, typename Derived> -MatrixCol<EigenBase<Scalar, Derived> > -EigenBase<Scalar, Derived>::col(int i) +MatrixCol<EiObject<Scalar, Derived> > +EiObject<Scalar, Derived>::col(int i) { - return MatrixCol<EigenBase>(ref(), i); + return MatrixCol<EiObject>(ref(), i); } #endif // EIGEN_ROWANDCOL_H diff --git a/src/internal/ScalarOps.h b/src/internal/ScalarOps.h index a28b7e6cb..1dd072cb2 100644 --- a/src/internal/ScalarOps.h +++ b/src/internal/ScalarOps.h @@ -26,14 +26,14 @@ #ifndef EIGEN_SCALAROPS_H #define EIGEN_SCALAROPS_H -template<typename MatrixType> class ScalarProduct - : public EigenBase<typename MatrixType::Scalar, ScalarProduct<MatrixType> > +template<typename MatrixType> class EiScalarProduct + : public EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - typedef ScalarProduct Ref; - friend class EigenBase<typename MatrixType::Scalar, ScalarProduct<MatrixType> >; + typedef EiScalarProduct Ref; + friend class EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime; @@ -64,7 +64,7 @@ template<typename MatrixType> class ScalarProduct #define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \ template<typename Scalar, typename Derived> \ ScalarProduct<Derived> \ -operator*(const EigenBase<Scalar, Derived>& matrix, \ +operator*(const EiObject<Scalar, Derived>& matrix, \ OtherScalar scalar) \ { \ return ScalarProduct<Derived>(matrix.ref(), scalar); \ @@ -73,14 +73,14 @@ operator*(const EigenBase<Scalar, Derived>& matrix, \ template<typename Scalar, typename Derived> \ ScalarProduct<Derived> \ operator*(OtherScalar scalar, \ - const EigenBase<Scalar, Derived>& matrix) \ + const EiObject<Scalar, Derived>& matrix) \ { \ return ScalarProduct<Derived>(matrix.ref(), scalar); \ } \ \ template<typename Scalar, typename Derived> \ ScalarProduct<Derived> \ -operator/(const EigenBase<Scalar, Derived>& matrix, \ +operator/(const EiObject<Scalar, Derived>& matrix, \ OtherScalar scalar) \ { \ return matrix * (static_cast<typename Derived::Scalar>(1) / scalar); \ @@ -88,7 +88,7 @@ operator/(const EigenBase<Scalar, Derived>& matrix, \ \ template<typename Scalar, typename Derived> \ Derived & \ -EigenBase<Scalar, Derived>::operator*=(const OtherScalar &other) \ +EiObject<Scalar, Derived>::operator*=(const OtherScalar &other) \ { \ *this = *this * other; \ return *static_cast<Derived*>(this); \ @@ -96,7 +96,7 @@ EigenBase<Scalar, Derived>::operator*=(const OtherScalar &other) \ \ template<typename Scalar, typename Derived> \ Derived & \ -EigenBase<Scalar, Derived>::operator/=(const OtherScalar &other) \ +EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \ { \ *this = *this / other; \ return *static_cast<Derived*>(this); \ diff --git a/src/internal/Util.h b/src/internal/Util.h index 179f70ffd..d4362383e 100644 --- a/src/internal/Util.h +++ b/src/internal/Util.h @@ -41,53 +41,48 @@ assert(col >= 0 && col < (matrix).cols()) //forward declarations -template<typename _Scalar, int _Rows, int _Cols> class Matrix; -template<typename MatrixType> class MatrixAlias; -template<typename MatrixType> class MatrixRef; -template<typename MatrixType> class MatrixRow; -template<typename MatrixType> class MatrixCol; -template<typename MatrixType> class MatrixMinor; -template<typename MatrixType> class MatrixBlock; -template<typename Lhs, typename Rhs> class MatrixSum; -template<typename Lhs, typename Rhs> class MatrixDifference; -template<typename Lhs, typename Rhs> class MatrixProduct; -template<typename MatrixType> class ScalarProduct; +template<typename _Scalar, int _Rows, int _Cols> class EiMatrix; +template<typename MatrixType> class EiMatrixRef; +template<typename MatrixType> class EiRow; +template<typename MatrixType> class EiColumn; +template<typename MatrixType> class EiMinor; +template<typename MatrixType> class EiBlock; +template<typename Lhs, typename Rhs> class EiSum; +template<typename Lhs, typename Rhs> class EiDifference; +template<typename Lhs, typename Rhs> class EiMatrixProduct; +template<typename MatrixType> class EiScalarProduct; -template<typename T> struct ForwardDecl +template<typename T> struct EiForwardDecl { typedef T Ref; }; -template<typename _Scalar, int _Rows, int _Cols> struct ForwardDecl<Matrix<_Scalar, _Rows, _Cols> > +template<typename _Scalar, int _Rows, int _Cols> +struct EiForwardDecl<EiMatrix<_Scalar, _Rows, _Cols> > { - typedef MatrixRef<Matrix<_Scalar, _Rows, _Cols> > Ref; + typedef EiMatrixRef<EiMatrix<_Scalar, _Rows, _Cols> > Ref; }; -template<typename MatrixType> struct ForwardDecl<MatrixAlias<MatrixType> > -{ - typedef MatrixRef<MatrixAlias<MatrixType> > Ref; -}; - -const int DynamicSize = -1; +const int EiDynamic = -1; #define EIGEN_UNUSED(x) (void)x #define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ template<typename OtherScalar, typename OtherDerived> \ -Derived& operator Op(const EigenBase<OtherScalar, OtherDerived>& other) \ +Derived& operator Op(const EiObject<OtherScalar, OtherDerived>& other) \ { \ - return EigenBase<Scalar, Derived>::operator Op(other); \ + return EiObject<Scalar, Derived>::operator Op(other); \ } \ Derived& operator Op(const Derived& other) \ { \ - return EigenBase<Scalar, Derived>::operator Op(other); \ + return EiObject<Scalar, Derived>::operator Op(other); \ } #define EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ template<typename Other> \ Derived& operator Op(const Other& scalar) \ { \ - return EigenBase<Scalar, Derived>::operator Op(scalar); \ + return EiObject<Scalar, Derived>::operator Op(scalar); \ } #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ diff --git a/test/matrixmanip.cpp b/test/matrixmanip.cpp index c95d33d1f..608dc1dad 100644 --- a/test/matrixmanip.cpp +++ b/test/matrixmanip.cpp @@ -47,7 +47,7 @@ void EigenTest::testMatrixManip() matrixManip(Matrix<int, 2, 3>()); matrixManip(Matrix<double, 3, 3>()); matrixManip(Matrix<complex<float>, 4,3>()); - matrixManip(MatrixXi(2, 2)); - matrixManip(MatrixXd(3, 5)); - matrixManip(MatrixXcf(4, 4)); + matrixManip(EiMatrixXi(2, 2)); + matrixManip(EiMatrixXd(3, 5)); + matrixManip(EiMatrixXcf(4, 4)); } diff --git a/test/matrixops.cpp b/test/matrixops.cpp index f148d8a82..059cb6126 100644 --- a/test/matrixops.cpp +++ b/test/matrixops.cpp @@ -62,10 +62,10 @@ void EigenTest::testMatrixOps() matrixOps(Matrix<int, 2, 3>(), Matrix<int, 3, 1>()); matrixOps(Matrix<double, 3, 3>(), Matrix<double, 3, 3>()); matrixOps(Matrix<complex<float>, 4,3>(), Matrix<complex<float>, 3,4>()); - matrixOps(MatrixXf(1, 1), MatrixXf(1, 3)); - matrixOps(MatrixXi(2, 2), MatrixXi(2, 2)); - matrixOps(MatrixXd(3, 5), MatrixXd(5, 1)); - matrixOps(MatrixXcf(4, 4), MatrixXcf(4, 4)); - matrixOps(MatrixXd(3, 5), Matrix<double, 5, 1>()); - matrixOps(Matrix4cf(), MatrixXcf(4, 4)); + matrixOps(EiMatrixXf(1, 1), EiMatrixXf(1, 3)); + matrixOps(EiMatrixXi(2, 2), EiMatrixXi(2, 2)); + matrixOps(EiMatrixXd(3, 5), EiMatrixXd(5, 1)); + matrixOps(EiMatrixXcf(4, 4), EiMatrixXcf(4, 4)); + matrixOps(EiMatrixXd(3, 5), Matrix<double, 5, 1>()); + matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4)); } |