diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-09-27 19:54:04 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-09-27 19:54:04 +0000 |
commit | 28c44a95c21bb18ec265faba69e750c430045f9c (patch) | |
tree | afaf7675f2b33c7818f846f72da8367a67fa714d | |
parent | 5160e9d0292b7ebf39376803c5b7764f0f838714 (diff) |
Finish prefixing everything with "Ei"
-rw-r--r-- | doc/tutorial.cpp | 4 | ||||
-rw-r--r-- | src/All | 6 | ||||
-rw-r--r-- | src/Core | 6 | ||||
-rw-r--r-- | src/Manip | 6 | ||||
-rw-r--r-- | src/internal/Block.h | 8 | ||||
-rw-r--r-- | src/internal/Matrix.h | 88 | ||||
-rw-r--r-- | src/internal/MatrixOps.h | 48 | ||||
-rw-r--r-- | src/internal/MatrixRef.h | 18 | ||||
-rw-r--r-- | src/internal/MatrixStorage.h | 26 | ||||
-rw-r--r-- | src/internal/Minor.h | 22 | ||||
-rw-r--r-- | src/internal/Object.h (renamed from src/internal/EiObject.h) | 14 | ||||
-rw-r--r-- | src/internal/RowAndCol.h | 62 | ||||
-rw-r--r-- | src/internal/ScalarOps.h | 48 | ||||
-rw-r--r-- | src/internal/Util.h | 32 | ||||
-rw-r--r-- | test/main.h | 6 | ||||
-rw-r--r-- | test/matrixmanip.cpp | 6 | ||||
-rw-r--r-- | test/matrixops.cpp | 10 | ||||
-rw-r--r-- | test/vectorops.cpp | 14 |
18 files changed, 211 insertions, 213 deletions
diff --git a/doc/tutorial.cpp b/doc/tutorial.cpp index 38943ec50..b0e13687b 100644 --- a/doc/tutorial.cpp +++ b/doc/tutorial.cpp @@ -4,7 +4,7 @@ using namespace std; int main(int, char **) { - Matrix<double,2,2> m; // 2x2 fixed-size matrix with uninitialized entries + EiMatrix<double,2,2> m; // 2x2 fixed-size matrix with uninitialized entries m(0,0) = 1; m(0,1) = 2; m(1,0) = 3; @@ -35,7 +35,7 @@ int main(int, char **) cout << "We want to store that into m, i.e. do \"m = m * m;\"" << endl; cout << "Here we must be very careful. For if we do \"m = m * m;\"," << endl << "the matrix m becomes" << endl; - Matrix<double,2,2> m_save = m; + EiMatrix<double,2,2> m_save = m; m = m * m; // the bogus operation cout << m << "," << endl; cout << "which is not what was wanted!" << endl @@ -23,10 +23,10 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_ALL_H -#define EIGEN_ALL_H +#ifndef EI_ALL_H +#define EI_ALL_H #include "Core" #include "Manip" -#endif // EIGEN_ALL_H +#endif // EI_ALL_H @@ -23,10 +23,10 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_CORE_H -#define EIGEN_CORE_H +#ifndef EI_CORE_H +#define EI_CORE_H //#include "internal/Vector.h" #include "internal/Matrix.h" -#endif // EIGEN_CORE_H +#endif // EI_CORE_H @@ -23,11 +23,11 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_MANIP_H -#define EIGEN_MANIP_H +#ifndef EI_MANIP_H +#define EI_MANIP_H #include "internal/RowAndCol.h" #include "internal/Block.h" #include "internal/Minor.h" -#endif // EIGEN_MANIP_H +#endif // EI_MANIP_H diff --git a/src/internal/Block.h b/src/internal/Block.h index 93ddddcb7..ca2c67465 100644 --- a/src/internal/Block.h +++ b/src/internal/Block.h @@ -23,8 +23,8 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_BLOCK_H -#define EIGEN_BLOCK_H +#ifndef EI_BLOCK_H +#define EI_BLOCK_H template<typename MatrixType> class EiBlock : public EiObject<typename MatrixType::Scalar, EiBlock<MatrixType> > @@ -52,7 +52,7 @@ template<typename MatrixType> class EiBlock : 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(EiBlock) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiBlock) private: const Ref& _ref() const { return *this; } @@ -81,4 +81,4 @@ EiObject<Scalar, Derived>::block(int startRow, int endRow, int startCol, int end return EiBlock<EiObject>(ref(), startRow, endRow, startCol, endCol); } -#endif // EIGEN_BLOCK_H +#endif // EI_BLOCK_H diff --git a/src/internal/Matrix.h b/src/internal/Matrix.h index 00780ae43..d56ac455a 100644 --- a/src/internal/Matrix.h +++ b/src/internal/Matrix.h @@ -23,30 +23,27 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_MATRIX_H -#define EIGEN_MATRIX_H +#ifndef EI_MATRIX_H +#define EI_MATRIX_H #include "Util.h" -#include "EiObject.h" +#include "Object.h" #include "MatrixRef.h" #include "MatrixStorage.h" template<typename _Scalar, int _Rows, int _Cols> -class EiMatrix : public EiObject<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, - public MatrixStorage<_Scalar, _Rows, _Cols> +class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >, + public EiMatrixStorage<_Scalar, _Rows, _Cols> { public: - friend class EiObject<_Scalar, Matrix>; - typedef EiObject<_Scalar, Matrix> Base; - typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage; - typedef _Scalar Scalar; - typedef MatrixRef<Matrix> Ref; - typedef MatrixAlias<Matrix> Alias; + friend class EiObject<_Scalar, EiMatrix>; + typedef EiObject<_Scalar, EiMatrix> Base; + typedef EiMatrixStorage<_Scalar, _Rows, _Cols> Storage; + typedef _Scalar Scalar; + typedef EiMatrixRef<EiMatrix> Ref; static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols; - Alias alias(); - const Scalar* array() const { return Storage::m_array; } @@ -54,80 +51,81 @@ class EiMatrix : public EiObject<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, { return Storage::m_array; } private: - Ref _ref() const { return Ref(*const_cast<Matrix*>(this)); } + Ref _ref() const { return Ref(*const_cast<EiMatrix*>(this)); } const Scalar& _read(int row, int col = 0) const { - EIGEN_CHECK_RANGES(*this, row, col); + EI_CHECK_RANGES(*this, row, col); return array()[row + col * Storage::_rows()]; } Scalar& _write(int row, int col = 0) { - EIGEN_CHECK_RANGES(*this, row, col); + EI_CHECK_RANGES(*this, row, col); return array()[row + col * Storage::_rows()]; } public: template<typename OtherDerived> - Matrix& operator=(const EiObject<Scalar, OtherDerived>& other) + EiMatrix& operator=(const EiObject<Scalar, OtherDerived>& other) { resize(other.rows(), other.cols()); return Base::operator=(other); } - Matrix& operator=(const Matrix& other) + + EiMatrix& operator=(const EiMatrix& other) { resize(other.rows(), other.cols()); return Base::operator=(other); } - EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=) - EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=) - EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=) - EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, /=) + EI_INHERIT_ASSIGNMENT_OPERATOR(EiMatrix, +=) + EI_INHERIT_ASSIGNMENT_OPERATOR(EiMatrix, -=) + EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(EiMatrix, *=) + EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(EiMatrix, /=) - explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} + explicit EiMatrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} template<typename OtherDerived> - Matrix(const EiObject<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols()) + EiMatrix(const EiObject<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols()) { *this = other; } - Matrix(const Matrix& other) : Storage(other.rows(), other.cols()) + EiMatrix(const EiMatrix& other) : Storage(other.rows(), other.cols()) { *this = other; } - ~Matrix() {} + ~EiMatrix() {} }; template<typename Scalar, typename Derived> -Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> +EiMatrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> eval(const EiObject<Scalar, Derived>& expression) { - return Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression); + return EiMatrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression); } -#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ -typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \ -typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; +#define EI_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +typedef EiMatrix<Type, Size, Size> EiMatrix##SizeSuffix##TypeSuffix; \ +typedef EiMatrix<Type, Size, 1> EiVector##SizeSuffix##TypeSuffix; -#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, 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, EiDynamic, X) +#define EI_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EI_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EI_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EI_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EI_MAKE_TYPEDEFS(Type, TypeSuffix, EiDynamic, X) -EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i) -EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) -EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d) -EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<int>, ci) -EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf) -EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd) +EI_MAKE_TYPEDEFS_ALL_SIZES(int, i) +EI_MAKE_TYPEDEFS_ALL_SIZES(float, f) +EI_MAKE_TYPEDEFS_ALL_SIZES(double, d) +EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<int>, ci) +EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf) +EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd) -#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES -#undef EIGEN_MAKE_TYPEDEFS +#undef EI_MAKE_TYPEDEFS_ALL_SIZES +#undef EI_MAKE_TYPEDEFS #include "MatrixOps.h" #include "ScalarOps.h" #include "RowAndCol.h" -#endif // EIGEN_MATRIX_H +#endif // EI_MATRIX_H diff --git a/src/internal/MatrixOps.h b/src/internal/MatrixOps.h index 4f28c179a..f5120277b 100644 --- a/src/internal/MatrixOps.h +++ b/src/internal/MatrixOps.h @@ -23,32 +23,32 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_MATRIXOPS_H -#define EIGEN_MATRIXOPS_H +#ifndef EI_MATRIXOPS_H +#define EI_MATRIXOPS_H template<typename Lhs, typename Rhs> class EiSum - : public EiObject<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> > + : public EiObject<typename Lhs::Scalar, EiSum<Lhs, Rhs> > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; - friend class EiObject<Scalar, MatrixSum>; + friend class EiObject<Scalar, EiSum>; typedef EiSum Ref; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; - MatrixSum(const LhsRef& lhs, const RhsRef& rhs) + EiSum(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) { assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - MatrixSum(const MatrixSum& other) + EiSum(const EiSum& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixSum) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiSum) private: @@ -67,28 +67,28 @@ template<typename Lhs, typename Rhs> class EiSum }; template<typename Lhs, typename Rhs> class EiDifference - : public EiObject<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> > + : public EiObject<typename Lhs::Scalar, EiDifference<Lhs, Rhs> > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; - friend class EiObject<Scalar, MatrixDifference>; + friend class EiObject<Scalar, EiDifference>; typedef EiDifference Ref; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; - MatrixDifference(const LhsRef& lhs, const RhsRef& rhs) + EiDifference(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) { assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - MatrixDifference(const MatrixDifference& other) + EiDifference(const EiDifference& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixDifference) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiDifference) private: const Ref& _ref() const { return *this; } @@ -106,28 +106,28 @@ template<typename Lhs, typename Rhs> class EiDifference }; template<typename Lhs, typename Rhs> class EiMatrixProduct - : public EiObject<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> > + : public EiObject<typename Lhs::Scalar, EiMatrixProduct<Lhs, Rhs> > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; - friend class EiObject<Scalar, MatrixProduct>; + friend class EiObject<Scalar, EiMatrixProduct>; typedef EiMatrixProduct Ref; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; - MatrixProduct(const LhsRef& lhs, const RhsRef& rhs) + EiMatrixProduct(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) { assert(lhs.cols() == rhs.rows()); } - MatrixProduct(const MatrixProduct& other) + EiMatrixProduct(const EiMatrixProduct& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixProduct) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixProduct) private: const Ref& _ref() const { return *this; } @@ -148,24 +148,24 @@ template<typename Lhs, typename Rhs> class EiMatrixProduct }; template<typename Scalar, typename Derived1, typename Derived2> -MatrixSum<Derived1, Derived2> +EiSum<Derived1, Derived2> operator+(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2) { - return MatrixSum<Derived1, Derived2>(mat1.ref(), mat2.ref()); + return EiSum<Derived1, Derived2>(mat1.ref(), mat2.ref()); } template<typename Scalar, typename Derived1, typename Derived2> -MatrixDifference<Derived1, Derived2> +EiDifference<Derived1, Derived2> operator-(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2) { - return MatrixDifference<Derived1, Derived2>(mat1.ref(), mat2.ref()); + return EiDifference<Derived1, Derived2>(mat1.ref(), mat2.ref()); } template<typename Scalar, typename Derived1, typename Derived2> -MatrixProduct<Derived1, Derived2> +EiMatrixProduct<Derived1, Derived2> operator*(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2) { - return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref()); + return EiMatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref()); } template<typename Scalar, typename Derived> @@ -195,4 +195,4 @@ EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &othe return *static_cast<Derived*>(this); } -#endif // EIGEN_MATRIXOPS_H +#endif // EI_MATRIXOPS_H diff --git a/src/internal/MatrixRef.h b/src/internal/MatrixRef.h index 2e999d6d3..57e44e69c 100644 --- a/src/internal/MatrixRef.h +++ b/src/internal/MatrixRef.h @@ -23,21 +23,21 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_MATRIXREF_H -#define EIGEN_MATRIXREF_H +#ifndef EI_MATRIXREF_H +#define EI_MATRIXREF_H template<typename MatrixType> class EiMatrixRef - : public EiObject<typename MatrixType::Scalar, MatrixRef<MatrixType> > + : public EiObject<typename MatrixType::Scalar, EiMatrixRef<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; - friend class EiObject<Scalar, MatrixRef>; + friend class EiObject<Scalar, EiMatrixRef>; - MatrixRef(MatrixType& matrix) : m_matrix(matrix) {} - MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {} - ~MatrixRef() {} + EiMatrixRef(MatrixType& matrix) : m_matrix(matrix) {} + EiMatrixRef(const EiMatrixRef& other) : m_matrix(other.m_matrix) {} + ~EiMatrixRef() {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixRef) private: int _rows() const { return m_matrix.rows(); } @@ -57,4 +57,4 @@ template<typename MatrixType> class EiMatrixRef MatrixType& m_matrix; }; -#endif // EIGEN_MATRIXREF_H +#endif // EI_MATRIXREF_H diff --git a/src/internal/MatrixStorage.h b/src/internal/MatrixStorage.h index 9554bf961..822903b14 100644 --- a/src/internal/MatrixStorage.h +++ b/src/internal/MatrixStorage.h @@ -23,8 +23,8 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_MATRIXSTORAGE_H -#define EIGEN_MATRIXSTORAGE_H +#ifndef EI_MATRIXSTORAGE_H +#define EI_MATRIXSTORAGE_H template<typename Scalar, int RowsAtCompileTime, @@ -44,18 +44,18 @@ class EiMatrixStorage { return ColsAtCompileTime; } public: - MatrixStorage(int rows, int cols) + EiMatrixStorage(int rows, int cols) { - EIGEN_UNUSED(rows); - EIGEN_UNUSED(cols); + EI_UNUSED(rows); + EI_UNUSED(cols); assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0); } - ~MatrixStorage() {}; + ~EiMatrixStorage() {}; }; template<typename Scalar> -class MatrixStorage<Scalar, EiDynamic, 1> +class EiMatrixStorage<Scalar, EiDynamic, 1> { protected: int m_rows; @@ -77,18 +77,18 @@ class MatrixStorage<Scalar, EiDynamic, 1> { return 1; } public: - MatrixStorage(int rows, int cols) : m_rows(rows) + EiMatrixStorage(int rows, int cols) : m_rows(rows) { assert(m_rows > 0 && cols == 1); m_array = new Scalar[m_rows]; } - ~MatrixStorage() + ~EiMatrixStorage() { delete[] m_array; } }; template<typename Scalar> -class MatrixStorage<Scalar, EiDynamic, EiDynamic> +class EiMatrixStorage<Scalar, EiDynamic, EiDynamic> { protected: int m_rows, m_cols; @@ -113,14 +113,14 @@ class MatrixStorage<Scalar, EiDynamic, EiDynamic> { return m_cols; } public: - MatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols) + EiMatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols) { assert(m_rows > 0 && m_cols > 0); m_array = new Scalar[m_rows * m_cols]; } - ~MatrixStorage() + ~EiMatrixStorage() { delete[] m_array; } }; -#endif // EIGEN_MATRIXSTORAGE_H +#endif // EI_MATRIXSTORAGE_H diff --git a/src/internal/Minor.h b/src/internal/Minor.h index cc6fa0b18..77fa4b9c8 100644 --- a/src/internal/Minor.h +++ b/src/internal/Minor.h @@ -23,32 +23,32 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_MINOR_H -#define EIGEN_MINOR_H +#ifndef EI_MINOR_H +#define EI_MINOR_H template<typename MatrixType> class EiMinor - : public EiObject<typename MatrixType::Scalar, MatrixMinor<MatrixType> > + : public EiObject<typename MatrixType::Scalar, EiMinor<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject<Scalar, MatrixMinor<MatrixType> >; + friend class EiObject<Scalar, EiMinor<MatrixType> >; typedef EiMinor Ref; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1, ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1; - MatrixMinor(const MatRef& matrix, + EiMinor(const MatRef& matrix, int row, int col = 0) : m_matrix(matrix), m_row(row), m_col(col) { - EIGEN_CHECK_RANGES(matrix, row, col); + EI_CHECK_RANGES(matrix, row, col); } - MatrixMinor(const MatrixMinor& other) + EiMinor(const EiMinor& other) : m_matrix(other.m_matrix), m_row(other.m_row), m_col(other.m_col) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixMinor) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiMinor) private: const Ref& _ref() const { return *this; } @@ -71,10 +71,10 @@ template<typename MatrixType> class EiMinor }; template<typename Scalar, typename Derived> -MatrixMinor<EiObject<Scalar, Derived> > +EiMinor<EiObject<Scalar, Derived> > EiObject<Scalar, Derived>::minor(int row, int col) { - return MatrixMinor<EiObject>(ref(), row, col); + return EiMinor<EiObject>(ref(), row, col); } -#endif // EIGEN_MINOR_H +#endif // EI_MINOR_H diff --git a/src/internal/EiObject.h b/src/internal/Object.h index 290d60b15..6bf86f87a 100644 --- a/src/internal/EiObject.h +++ b/src/internal/Object.h @@ -23,8 +23,8 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_EIGENBASE_H -#define EIGEN_EIGENBASE_H +#ifndef EI_EIGENBASE_H +#define EI_EIGENBASE_H #include "Util.h" @@ -33,7 +33,7 @@ template<typename _Scalar, typename Derived> class EiObject static const int RowsAtCompileTime = Derived::RowsAtCompileTime, ColsAtCompileTime = Derived::ColsAtCompileTime; public: - typedef typename ForwardDecl<Derived>::Ref Ref; + typedef typename EiForwardDecl<Derived>::Ref Ref; typedef _Scalar Scalar; int rows() const { return static_cast<const Derived *>(this)->_rows(); } @@ -77,9 +77,9 @@ template<typename _Scalar, typename Derived> class EiObject return *static_cast<Derived*>(this); } - MatrixRow<EiObject> row(int i); - MatrixCol<EiObject> col(int i); - MatrixMinor<EiObject> minor(int row, int col); + EiRow<EiObject> row(int i); + EiColumn<EiObject> col(int i); + EiMinor<EiObject> minor(int row, int col); EiBlock<EiObject> block(int startRow, int endRow, int startCol= 0, int endCol = 0); @@ -127,4 +127,4 @@ std::ostream & operator << return s; } -#endif // EIGEN_EIGENBASE_H +#endif // EI_EIGENBASE_H diff --git a/src/internal/RowAndCol.h b/src/internal/RowAndCol.h index 03e25651f..0bfc361b0 100644 --- a/src/internal/RowAndCol.h +++ b/src/internal/RowAndCol.h @@ -23,37 +23,37 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_ROWANDCOL_H -#define EIGEN_ROWANDCOL_H +#ifndef EI_ROWANDCOL_H +#define EI_ROWANDCOL_H template<typename MatrixType> class EiRow - : public EiObject<typename MatrixType::Scalar, MatrixRow<MatrixType> > + : public EiObject<typename MatrixType::Scalar, EiRow<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject<Scalar, MatrixRow<MatrixType> >; + friend class EiObject<Scalar, EiRow<MatrixType> >; typedef EiRow Ref; static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime, ColsAtCompileTime = 1; - MatrixRow(const MatRef& matrix, int row) + EiRow(const MatRef& matrix, int row) : m_matrix(matrix), m_row(row) { - EIGEN_CHECK_ROW_RANGE(matrix, row); + EI_CHECK_ROW_RANGE(matrix, row); } - MatrixRow(const MatrixRow& other) + EiRow(const EiRow& other) : m_matrix(other.m_matrix), m_row(other.m_row) {} template<typename OtherDerived> - MatrixRow& operator=(const EiObject<Scalar, OtherDerived>& other) + EiRow& operator=(const EiObject<Scalar, OtherDerived>& other) { - return EiObject<Scalar, MatrixRow<MatrixType> >::operator=(other); + return EiObject<Scalar, EiRow<MatrixType> >::operator=(other); } - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRow) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiRow) private: const Ref& _ref() const { return *this; } @@ -63,15 +63,15 @@ template<typename MatrixType> class EiRow Scalar& _write(int row, int col=0) { - EIGEN_UNUSED(col); - EIGEN_CHECK_ROW_RANGE(*this, row); + EI_UNUSED(col); + EI_CHECK_ROW_RANGE(*this, row); return m_matrix.write(m_row, row); } Scalar _read(int row, int col=0) const { - EIGEN_UNUSED(col); - EIGEN_CHECK_ROW_RANGE(*this, row); + EI_UNUSED(col); + EI_CHECK_ROW_RANGE(*this, row); return m_matrix.read(m_row, row); } @@ -80,28 +80,28 @@ template<typename MatrixType> class EiRow const int m_row; }; -template<typename MatrixType> class MatrixCol - : public EiObject<typename MatrixType::Scalar, MatrixCol<MatrixType> > +template<typename MatrixType> class EiColumn + : public EiObject<typename MatrixType::Scalar, EiColumn<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject<Scalar, MatrixCol<MatrixType> >; - typedef MatrixCol Ref; + friend class EiObject<Scalar, EiColumn<MatrixType> >; + typedef EiColumn Ref; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = 1; - MatrixCol(const MatRef& matrix, int col) + EiColumn(const MatRef& matrix, int col) : m_matrix(matrix), m_col(col) { - EIGEN_CHECK_COL_RANGE(matrix, col); + EI_CHECK_COL_RANGE(matrix, col); } - MatrixCol(const MatrixCol& other) + EiColumn(const EiColumn& other) : m_matrix(other.m_matrix), m_col(other.m_col) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixCol) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiColumn) private: const Ref& _ref() const { return *this; } @@ -110,15 +110,15 @@ template<typename MatrixType> class MatrixCol Scalar& _write(int row, int col=0) { - EIGEN_UNUSED(col); - EIGEN_CHECK_ROW_RANGE(*this, row); + EI_UNUSED(col); + EI_CHECK_ROW_RANGE(*this, row); return m_matrix.write(row, m_col); } Scalar _read(int row, int col=0) const { - EIGEN_UNUSED(col); - EIGEN_CHECK_ROW_RANGE(*this, row); + EI_UNUSED(col); + EI_CHECK_ROW_RANGE(*this, row); return m_matrix.read(row, m_col); } @@ -128,17 +128,17 @@ template<typename MatrixType> class MatrixCol }; template<typename Scalar, typename Derived> -MatrixRow<EiObject<Scalar, Derived> > +EiRow<EiObject<Scalar, Derived> > EiObject<Scalar, Derived>::row(int i) { - return MatrixRow<EiObject>(ref(), i); + return EiRow<EiObject>(ref(), i); } template<typename Scalar, typename Derived> -MatrixCol<EiObject<Scalar, Derived> > +EiColumn<EiObject<Scalar, Derived> > EiObject<Scalar, Derived>::col(int i) { - return MatrixCol<EiObject>(ref(), i); + return EiColumn<EiObject>(ref(), i); } -#endif // EIGEN_ROWANDCOL_H +#endif // EI_ROWANDCOL_H diff --git a/src/internal/ScalarOps.h b/src/internal/ScalarOps.h index 1dd072cb2..6d7de3bed 100644 --- a/src/internal/ScalarOps.h +++ b/src/internal/ScalarOps.h @@ -23,28 +23,28 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_SCALAROPS_H -#define EIGEN_SCALAROPS_H +#ifndef EI_SCALAROPS_H +#define EI_SCALAROPS_H template<typename MatrixType> class EiScalarProduct - : public EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> > + : public EiObject<typename MatrixType::Scalar, EiScalarProduct<MatrixType> > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; typedef EiScalarProduct Ref; - friend class EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >; + friend class EiObject<typename MatrixType::Scalar, EiScalarProduct<MatrixType> >; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime; - ScalarProduct(const MatRef& matrix, Scalar scalar) + EiScalarProduct(const MatRef& matrix, Scalar scalar) : m_matrix(matrix), m_scalar(scalar) {} - ScalarProduct(const ScalarProduct& other) + EiScalarProduct(const EiScalarProduct& other) : m_matrix(other.m_matrix), m_scalar(other.m_scalar) {} - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ScalarProduct) + EI_INHERIT_ASSIGNMENT_OPERATORS(EiScalarProduct) private: const Ref& _ref() const { return *this; } @@ -61,26 +61,26 @@ template<typename MatrixType> class EiScalarProduct const Scalar m_scalar; }; -#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \ +#define EI_MAKE_SCALAR_OPS(OtherScalar) \ template<typename Scalar, typename Derived> \ -ScalarProduct<Derived> \ -operator*(const EiObject<Scalar, Derived>& matrix, \ +EiScalarProduct<Derived> \ +operator*(const EiObject<Scalar, Derived>& matrix, \ OtherScalar scalar) \ { \ - return ScalarProduct<Derived>(matrix.ref(), scalar); \ + return EiScalarProduct<Derived>(matrix.ref(), scalar); \ } \ \ template<typename Scalar, typename Derived> \ -ScalarProduct<Derived> \ +EiScalarProduct<Derived> \ operator*(OtherScalar scalar, \ - const EiObject<Scalar, Derived>& matrix) \ + const EiObject<Scalar, Derived>& matrix) \ { \ - return ScalarProduct<Derived>(matrix.ref(), scalar); \ + return EiScalarProduct<Derived>(matrix.ref(), scalar); \ } \ \ template<typename Scalar, typename Derived> \ -ScalarProduct<Derived> \ -operator/(const EiObject<Scalar, Derived>& matrix, \ +EiScalarProduct<Derived> \ +operator/(const EiObject<Scalar, Derived>& matrix, \ OtherScalar scalar) \ { \ return matrix * (static_cast<typename Derived::Scalar>(1) / scalar); \ @@ -102,13 +102,13 @@ EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \ return *static_cast<Derived*>(this); \ } -EIGEN_MAKE_SCALAR_OPS(int) -EIGEN_MAKE_SCALAR_OPS(float) -EIGEN_MAKE_SCALAR_OPS(double) -EIGEN_MAKE_SCALAR_OPS(std::complex<int>) -EIGEN_MAKE_SCALAR_OPS(std::complex<float>) -EIGEN_MAKE_SCALAR_OPS(std::complex<double>) +EI_MAKE_SCALAR_OPS(int) +EI_MAKE_SCALAR_OPS(float) +EI_MAKE_SCALAR_OPS(double) +EI_MAKE_SCALAR_OPS(std::complex<int>) +EI_MAKE_SCALAR_OPS(std::complex<float>) +EI_MAKE_SCALAR_OPS(std::complex<double>) -#undef EIGEN_MAKE_SCALAR_OPS +#undef EI_MAKE_SCALAR_OPS -#endif // EIGEN_SCALAROPS_H +#endif // EI_SCALAROPS_H diff --git a/src/internal/Util.h b/src/internal/Util.h index d4362383e..05ebbe163 100644 --- a/src/internal/Util.h +++ b/src/internal/Util.h @@ -23,8 +23,8 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_UTIL_H -#define EIGEN_UTIL_H +#ifndef EI_UTIL_H +#define EI_UTIL_H #include <iostream> #include <complex> @@ -32,12 +32,12 @@ #undef minor -#define EIGEN_UNUSED(x) (void)x -#define EIGEN_CHECK_RANGES(matrix, row, col) \ +#define EI_UNUSED(x) (void)x +#define EI_CHECK_RANGES(matrix, row, col) \ assert(row >= 0 && row < (matrix).rows() && col >= 0 && col < (matrix).cols()) -#define EIGEN_CHECK_ROW_RANGE(matrix, row) \ +#define EI_CHECK_ROW_RANGE(matrix, row) \ assert(row >= 0 && row < (matrix).rows()) -#define EIGEN_CHECK_COL_RANGE(matrix, col) \ +#define EI_CHECK_COL_RANGE(matrix, col) \ assert(col >= 0 && col < (matrix).cols()) //forward declarations @@ -65,9 +65,9 @@ struct EiForwardDecl<EiMatrix<_Scalar, _Rows, _Cols> > const int EiDynamic = -1; -#define EIGEN_UNUSED(x) (void)x +#define EI_UNUSED(x) (void)x -#define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ +#define EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ template<typename OtherScalar, typename OtherDerived> \ Derived& operator Op(const EiObject<OtherScalar, OtherDerived>& other) \ { \ @@ -78,18 +78,18 @@ Derived& operator Op(const Derived& other) \ return EiObject<Scalar, Derived>::operator Op(other); \ } -#define EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ +#define EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ template<typename Other> \ Derived& operator Op(const Other& scalar) \ { \ return EiObject<Scalar, Derived>::operator Op(scalar); \ } -#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ -EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \ -EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \ -EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \ -EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \ -EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=) +#define EI_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ +EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \ +EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \ +EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \ +EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \ +EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=) -#endif // EIGEN_UTIL_H +#endif // EI_UTIL_H diff --git a/test/main.h b/test/main.h index 0ae9967b5..1cdc781d7 100644 --- a/test/main.h +++ b/test/main.h @@ -23,8 +23,8 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_TEST_MAIN_H -#define EIGEN_TEST_MAIN_H +#ifndef EI_TEST_MAIN_H +#define EI_TEST_MAIN_H #include <QtTest/QtTest> #include <All> @@ -47,4 +47,4 @@ class EigenTest : public QObject void testMatrixManip(); }; -#endif // EIGEN_TEST_MAIN_H +#endif // EI_TEST_MAIN_H diff --git a/test/matrixmanip.cpp b/test/matrixmanip.cpp index 608dc1dad..4851a9178 100644 --- a/test/matrixmanip.cpp +++ b/test/matrixmanip.cpp @@ -44,9 +44,9 @@ template<typename MatrixType> void matrixManip(const MatrixType& m) void EigenTest::testMatrixManip() { - matrixManip(Matrix<int, 2, 3>()); - matrixManip(Matrix<double, 3, 3>()); - matrixManip(Matrix<complex<float>, 4,3>()); + matrixManip(EiMatrix<int, 2, 3>()); + matrixManip(EiMatrix<double, 3, 3>()); + matrixManip(EiMatrix<complex<float>, 4,3>()); matrixManip(EiMatrixXi(2, 2)); matrixManip(EiMatrixXd(3, 5)); matrixManip(EiMatrixXcf(4, 4)); diff --git a/test/matrixops.cpp b/test/matrixops.cpp index 059cb6126..e5f01759e 100644 --- a/test/matrixops.cpp +++ b/test/matrixops.cpp @@ -58,14 +58,14 @@ template<typename MatrixType1, void EigenTest::testMatrixOps() { - matrixOps(Matrix<float, 1, 1>(), Matrix<float, 1, 1>()); - 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(EiMatrix<float, 1, 1>(), EiMatrix<float, 1, 1>()); + matrixOps(EiMatrix<int, 2, 3>(), EiMatrix<int, 3, 1>()); + matrixOps(EiMatrix<double, 3, 3>(), EiMatrix<double, 3, 3>()); + matrixOps(EiMatrix<complex<float>, 4,3>(), EiMatrix<complex<float>, 3,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(EiMatrixXd(3, 5), EiMatrix<double, 5, 1>()); matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4)); } diff --git a/test/vectorops.cpp b/test/vectorops.cpp index 1ac9c45df..b061206c2 100644 --- a/test/vectorops.cpp +++ b/test/vectorops.cpp @@ -53,11 +53,11 @@ template<typename VectorType> void vectorOps(const VectorType& v) void EigenTest::testVectorOps() { - vectorOps(Vector2i()); - vectorOps(Vector3d()); - vectorOps(Vector4cf()); - vectorOps(VectorXf(1)); - vectorOps(VectorXi(2)); - vectorOps(VectorXd(3)); - vectorOps(VectorXcf(4)); + vectorOps(EiVector2i()); + vectorOps(EiVector3d()); + vectorOps(EiVector4cf()); + vectorOps(EiVectorXf(1)); + vectorOps(EiVectorXi(2)); + vectorOps(EiVectorXd(3)); + vectorOps(EiVectorXcf(4)); } |