From afc64f3332941653a52faa7d441c6af1adbaccc7 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 13 Mar 2008 09:33:26 +0000 Subject: a lot of renaming internal classes: AaBb -> ei_aa_bb IntAtRunTimeIfDynamic -> ei_int_if_dynamic unify UNROLLING_LIMIT (there was no reason to have operator= use a higher limit) etc... --- Eigen/src/Core/Block.h | 10 +++---- Eigen/src/Core/CwiseBinaryOp.h | 35 ++++++++++-------------- Eigen/src/Core/CwiseUnaryOp.h | 52 +++++++++++++++++------------------ Eigen/src/Core/DiagonalCoeffs.h | 2 +- Eigen/src/Core/DiagonalMatrix.h | 4 +-- Eigen/src/Core/Dot.h | 18 ++++++------ Eigen/src/Core/Eval.h | 4 +-- Eigen/src/Core/EvalOMP.h | 4 +-- Eigen/src/Core/ForwardDeclarations.h | 16 ++++++----- Eigen/src/Core/Identity.h | 8 +++--- Eigen/src/Core/Map.h | 2 +- Eigen/src/Core/Matrix.h | 4 +-- Eigen/src/Core/MatrixBase.h | 22 +++++++-------- Eigen/src/Core/MatrixRef.h | 2 +- Eigen/src/Core/MatrixStorage.h | 47 ++++++++++++++++---------------- Eigen/src/Core/Minor.h | 2 +- Eigen/src/Core/Ones.h | 8 +++--- Eigen/src/Core/OperatorEquals.h | 32 +++++++++++----------- Eigen/src/Core/Product.h | 20 +++++++------- Eigen/src/Core/Random.h | 8 +++--- Eigen/src/Core/Trace.h | 16 +++++------ Eigen/src/Core/Transpose.h | 6 ++-- Eigen/src/Core/Util.h | 53 +++++++++++++++--------------------- Eigen/src/Core/Zero.h | 8 +++--- bench/bench_unrolling | 2 +- doc/examples/class_Cast.cpp | 6 ++-- test/submatrices.cpp | 2 +- 27 files changed, 190 insertions(+), 203 deletions(-) diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index a2a581aac..7b504239a 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -75,7 +75,7 @@ template class Block { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Block) + EIGEN_GENERIC_PUBLIC_INTERFACE(Block) typedef typename MatrixType::AsArg MatRef; @@ -142,10 +142,10 @@ template class Block protected: MatRef m_matrix; - IntAtRunTimeIfDynamic m_startRow; - IntAtRunTimeIfDynamic m_startCol; - IntAtRunTimeIfDynamic m_blockRows; - IntAtRunTimeIfDynamic m_blockCols; + ei_int_if_dynamic m_startRow; + ei_int_if_dynamic m_startCol; + ei_int_if_dynamic m_blockRows; + ei_int_if_dynamic m_blockCols; }; /** \returns a dynamic-size expression of a block in *this. diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 63e0fbac0..7478f6256 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -44,7 +44,7 @@ * Here is an example illustrating this: * \include class_CwiseBinaryOp.cpp * - * \sa class ScalarProductOp, class ScalarQuotientOp + * \sa class ei_scalar_product_op, class ei_scalar_quotient_op */ template struct ei_traits > @@ -64,12 +64,12 @@ struct ei_traits > }; template -class CwiseBinaryOp : NoOperatorEquals, +class CwiseBinaryOp : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(CwiseBinaryOp) + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) typedef typename Lhs::AsArg LhsRef; typedef typename Rhs::AsArg RhsRef; @@ -102,7 +102,7 @@ class CwiseBinaryOp : NoOperatorEquals, * * \sa class CwiseBinaryOp, MatrixBase::operator+ */ -struct ScalarSumOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_sum_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } }; @@ -111,7 +111,7 @@ struct ScalarSumOp EIGEN_EMPTY_STRUCT { * * \sa class CwiseBinaryOp, MatrixBase::operator- */ -struct ScalarDifferenceOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_difference_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } }; @@ -120,7 +120,7 @@ struct ScalarDifferenceOp EIGEN_EMPTY_STRUCT { * * \sa class CwiseBinaryOp, MatrixBase::cwiseProduct() */ -struct ScalarProductOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_product_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; } }; @@ -129,7 +129,7 @@ struct ScalarProductOp EIGEN_EMPTY_STRUCT { * * \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient() */ -struct ScalarQuotientOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_quotient_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } }; @@ -140,10 +140,10 @@ struct ScalarQuotientOp EIGEN_EMPTY_STRUCT { * \sa class CwiseBinaryOp, MatrixBase::operator-=() */ template -const CwiseBinaryOp +const CwiseBinaryOp operator-(const MatrixBase &mat1, const MatrixBase &mat2) { - return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); + return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); } /** replaces \c *this by \c *this - \a other. @@ -158,7 +158,6 @@ MatrixBase::operator-=(const MatrixBase &other) return *this = *this - other; } - /** \relates MatrixBase * * \returns an expression of the sum of \a mat1 and \a mat2 @@ -166,10 +165,10 @@ MatrixBase::operator-=(const MatrixBase &other) * \sa class CwiseBinaryOp, MatrixBase::operator+=() */ template -const CwiseBinaryOp +const CwiseBinaryOp operator+(const MatrixBase &mat1, const MatrixBase &mat2) { - return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); + return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); } /** replaces \c *this by \c *this + \a other. @@ -184,33 +183,30 @@ MatrixBase::operator+=(const MatrixBase& other) return *this = *this + other; } - /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other * * \sa class CwiseBinaryOp */ template template -const CwiseBinaryOp +const CwiseBinaryOp MatrixBase::cwiseProduct(const MatrixBase &other) const { - return CwiseBinaryOp(asArg(), other.asArg()); + return CwiseBinaryOp(asArg(), other.asArg()); } - /** \returns an expression of the coefficient-wise quotient of *this and \a other * * \sa class CwiseBinaryOp */ template template -const CwiseBinaryOp +const CwiseBinaryOp MatrixBase::cwiseQuotient(const MatrixBase &other) const { - return CwiseBinaryOp(asArg(), other.asArg()); + return CwiseBinaryOp(asArg(), other.asArg()); } - /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other * * The template parameter \a CustomBinaryOp is the type of the functor @@ -226,5 +222,4 @@ MatrixBase::cwise(const MatrixBase &other, const CustomBi return CwiseBinaryOp(asArg(), other.asArg(), func); } - #endif // EIGEN_CWISE_BINARY_OP_H diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index a2ad55aef..5fe2293e2 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -54,12 +54,12 @@ struct ei_traits > }; template -class CwiseUnaryOp : NoOperatorEquals, +class CwiseUnaryOp : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(CwiseUnaryOp) + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) typedef typename MatrixType::AsArg MatRef; @@ -86,7 +86,7 @@ class CwiseUnaryOp : NoOperatorEquals, * * \sa class CwiseUnaryOp, MatrixBase::operator- */ -struct ScalarOppositeOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_opposite_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a) const { return -a; } }; @@ -95,7 +95,7 @@ struct ScalarOppositeOp EIGEN_EMPTY_STRUCT { * * \sa class CwiseUnaryOp, MatrixBase::cwiseAbs */ -struct ScalarAbsOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_abs_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a) const { return ei_abs(a); } }; @@ -103,19 +103,19 @@ struct ScalarAbsOp EIGEN_EMPTY_STRUCT { /** \returns an expression of the opposite of \c *this */ template -const CwiseUnaryOp +const CwiseUnaryOp MatrixBase::operator-() const { - return CwiseUnaryOp(asArg()); + return CwiseUnaryOp(asArg()); } /** \returns an expression of the opposite of \c *this */ template -const CwiseUnaryOp +const CwiseUnaryOp MatrixBase::cwiseAbs() const { - return CwiseUnaryOp(asArg()); + return CwiseUnaryOp(asArg()); } @@ -143,7 +143,7 @@ MatrixBase::cwise(const CustomUnaryOp& func) const * * \sa class CwiseUnaryOp, MatrixBase::conjugate() */ -struct ScalarConjugateOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_conjugate_op EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a) const { return ei_conj(a); } }; @@ -151,10 +151,10 @@ struct ScalarConjugateOp EIGEN_EMPTY_STRUCT { * * \sa adjoint() */ template -const CwiseUnaryOp +const CwiseUnaryOp MatrixBase::conjugate() const { - return CwiseUnaryOp(asArg()); + return CwiseUnaryOp(asArg()); } /** \internal @@ -163,7 +163,7 @@ MatrixBase::conjugate() const * \sa class CwiseUnaryOp, MatrixBase::cast() */ template -struct ScalarCastOp EIGEN_EMPTY_STRUCT { +struct ei_scalar_cast_op EIGEN_EMPTY_STRUCT { typedef NewType result_type; template NewType operator() (const Scalar& a) const { return static_cast(a); } }; @@ -176,14 +176,14 @@ struct ScalarCastOp EIGEN_EMPTY_STRUCT { * Example: \include MatrixBase_cast.cpp * Output: \verbinclude MatrixBase_cast.out * - * \sa class CwiseUnaryOp, class ScalarCastOp + * \sa class CwiseUnaryOp, class ei_scalar_cast_op */ template template -const CwiseUnaryOp, Derived> +const CwiseUnaryOp, Derived> MatrixBase::cast() const { - return CwiseUnaryOp, Derived>(asArg()); + return CwiseUnaryOp, Derived>(asArg()); } /** \internal @@ -192,31 +192,31 @@ MatrixBase::cast() const * \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/ */ template -struct ScalarMultipleOp { - ScalarMultipleOp(const Scalar& other) : m_other(other) {} +struct ei_scalar_multiple_op { + ei_scalar_multiple_op(const Scalar& other) : m_other(other) {} Scalar operator() (const Scalar& a) const { return a * m_other; } const Scalar m_other; }; -/** \relates MatrixBase \sa class ScalarMultipleOp */ +/** \relates MatrixBase \sa class ei_scalar_multiple_op */ template -const CwiseUnaryOp::Scalar>, Derived> +const CwiseUnaryOp::Scalar>, Derived> MatrixBase::operator*(const Scalar& scalar) const { - return CwiseUnaryOp, Derived>(asArg(), ScalarMultipleOp(scalar)); + return CwiseUnaryOp, Derived>(asArg(), ei_scalar_multiple_op(scalar)); } -/** \relates MatrixBase \sa class ScalarMultipleOp */ +/** \relates MatrixBase \sa class ei_scalar_multiple_op */ template -const CwiseUnaryOp::Scalar>, Derived> +const CwiseUnaryOp::Scalar>, Derived> MatrixBase::operator/(const Scalar& scalar) const { assert(NumTraits::HasFloatingPoint); - return CwiseUnaryOp, Derived> - (asArg(), ScalarMultipleOp(static_cast(1) / scalar)); + return CwiseUnaryOp, Derived> + (asArg(), ei_scalar_multiple_op(static_cast(1) / scalar)); } -/** \sa ScalarMultipleOp */ +/** \sa ei_scalar_multiple_op */ template Derived& MatrixBase::operator*=(const Scalar& other) @@ -224,7 +224,7 @@ MatrixBase::operator*=(const Scalar& other) return *this = *this * other; } -/** \sa ScalarMultipleOp */ +/** \sa ei_scalar_multiple_op */ template Derived& MatrixBase::operator/=(const Scalar& other) diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h index e8bc04108..0eea3f93b 100644 --- a/Eigen/src/Core/DiagonalCoeffs.h +++ b/Eigen/src/Core/DiagonalCoeffs.h @@ -58,7 +58,7 @@ template class DiagonalCoeffs { public: - EIGEN_BASIC_PUBLIC_INTERFACE(DiagonalCoeffs) + EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalCoeffs) typedef typename MatrixType::AsArg MatRef; diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index e27d2c366..fc381a048 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -51,12 +51,12 @@ struct ei_traits > }; template -class DiagonalMatrix : NoOperatorEquals, +class DiagonalMatrix : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(DiagonalMatrix) + EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalMatrix) typedef typename CoeffsVectorType::AsArg CoeffsVecRef; diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index f4d13e517..4147dee56 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -26,17 +26,17 @@ #define EIGEN_DOT_H template -struct DotUnroller +struct ei_dot_unroller { static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { - DotUnroller::run(v1, v2, dot); + ei_dot_unroller::run(v1, v2, dot); dot += v1.coeff(Index) * ei_conj(v2.coeff(Index)); } }; template -struct DotUnroller<0, Size, Derived1, Derived2> +struct ei_dot_unroller<0, Size, Derived1, Derived2> { static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { @@ -45,14 +45,14 @@ struct DotUnroller<0, Size, Derived1, Derived2> }; template -struct DotUnroller +struct ei_dot_unroller { static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} }; // prevent buggy user code from causing an infinite recursion template -struct DotUnroller +struct ei_dot_unroller { static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} }; @@ -78,9 +78,9 @@ MatrixBase::dot(const MatrixBase& other) const Scalar res; if(EIGEN_UNROLLED_LOOPS && SizeAtCompileTime != Dynamic - && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) - DotUnroller > ::run(*static_cast(this), other, res); else @@ -123,7 +123,7 @@ typename NumTraits::Scalar>::Real MatrixBase -const CwiseUnaryOp::Scalar>, Derived> +const CwiseUnaryOp::Scalar>, Derived> MatrixBase::normalized() const { return (*this) / norm(); diff --git a/Eigen/src/Core/Eval.h b/Eigen/src/Core/Eval.h index ece372a04..c841a2887 100644 --- a/Eigen/src/Core/Eval.h +++ b/Eigen/src/Core/Eval.h @@ -56,7 +56,7 @@ struct ei_traits > }; }; -template class Eval : NoOperatorEquals, +template class Eval : ei_no_assignment_operator, public Matrix< typename ExpressionType::Scalar, ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime, @@ -81,7 +81,7 @@ template class Eval : NoOperatorEquals, ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime> MatrixType; - _EIGEN_BASIC_PUBLIC_INTERFACE(Eval, MatrixType) + _EIGEN_GENERIC_PUBLIC_INTERFACE(Eval, MatrixType) explicit Eval(const ExpressionType& expr) : MatrixType(expr) {} }; diff --git a/Eigen/src/Core/EvalOMP.h b/Eigen/src/Core/EvalOMP.h index 929e4515a..6c1f9a89f 100644 --- a/Eigen/src/Core/EvalOMP.h +++ b/Eigen/src/Core/EvalOMP.h @@ -51,7 +51,7 @@ struct ei_traits > }; }; -template class EvalOMP : NoOperatorEquals, +template class EvalOMP : ei_no_assignment_operator, public Matrix< typename ExpressionType::Scalar, ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime, @@ -72,7 +72,7 @@ template class EvalOMP : NoOperatorEquals, ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime> MatrixType; - _EIGEN_BASIC_PUBLIC_INTERFACE(EvalOMP, MatrixType) + _EIGEN_GENERIC_PUBLIC_INTERFACE(EvalOMP, MatrixType) #ifdef _OPENMP explicit EvalOMP(const ExpressionType& other) diff --git a/Eigen/src/Core/ForwardDeclarations.h b/Eigen/src/Core/ForwardDeclarations.h index a43a34745..3459eab5b 100644 --- a/Eigen/src/Core/ForwardDeclarations.h +++ b/Eigen/src/Core/ForwardDeclarations.h @@ -46,13 +46,15 @@ template class Map; template class Eval; template class EvalOMP; -struct ScalarProductOp; -struct ScalarQuotientOp; -struct ScalarOppositeOp; -struct ScalarConjugateOp; -struct ScalarAbsOp; -template struct ScalarCastOp; -template struct ScalarMultipleOp; +struct ei_scalar_sum_op; +struct ei_scalar_difference_op; +struct ei_scalar_product_op; +struct ei_scalar_quotient_op; +struct ei_scalar_opposite_op; +struct ei_scalar_conjugate_op; +struct ei_scalar_abs_op; +template struct ei_scalar_cast_op; +template struct ei_scalar_multiple_op; template struct Reference { diff --git a/Eigen/src/Core/Identity.h b/Eigen/src/Core/Identity.h index 5dd3ec609..2598402b2 100644 --- a/Eigen/src/Core/Identity.h +++ b/Eigen/src/Core/Identity.h @@ -43,12 +43,12 @@ struct ei_traits > }; }; -template class Identity : NoOperatorEquals, +template class Identity : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Identity) + EIGEN_GENERIC_PUBLIC_INTERFACE(Identity) Identity(int rows, int cols) : m_rows(rows), m_cols(cols) { @@ -70,8 +70,8 @@ template class Identity : NoOperatorEquals, } protected: - const IntAtRunTimeIfDynamic m_rows; - const IntAtRunTimeIfDynamic m_cols; + const ei_int_if_dynamic m_rows; + const ei_int_if_dynamic m_cols; }; /** \returns an expression of the identity matrix (not necessarily square). diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index e1b71952a..ece50087c 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -55,7 +55,7 @@ template class Map { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Map) + EIGEN_GENERIC_PUBLIC_INTERFACE(Map) private: diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index ffb960493..112f5f79e 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -91,7 +91,7 @@ class Matrix : public MatrixBase m_storage; + ei_matrix_storage m_storage; AsArg _asArg() const { return AsArg(*this); } int _rows() const { return m_storage.rows(); } diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 18ffdd00f..f89d861ea 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -230,17 +230,17 @@ template class MatrixBase /// \name matrix transformation //@{ template - const CwiseUnaryOp, Derived> cast() const; + const CwiseUnaryOp, Derived> cast() const; const DiagonalMatrix asDiagonal() const; Transpose transpose(); const Transpose transpose() const; - const CwiseUnaryOp conjugate() const; - const Transpose > adjoint() const; + const CwiseUnaryOp conjugate() const; + const Transpose > adjoint() const; - const CwiseUnaryOp, Derived> normalized() const; + const CwiseUnaryOp, Derived> normalized() const; //@} // FIXME not sure about the following name @@ -295,7 +295,7 @@ template class MatrixBase /// \name arithemetic operators //@{ - const CwiseUnaryOp operator-() const; + const CwiseUnaryOp operator-() const; template Derived& operator+=(const MatrixBase& other); @@ -307,10 +307,10 @@ template class MatrixBase Derived& operator*=(const Scalar& other); Derived& operator/=(const Scalar& other); - const CwiseUnaryOp, Derived> operator*(const Scalar& scalar) const; - const CwiseUnaryOp, Derived> operator/(const Scalar& scalar) const; + const CwiseUnaryOp, Derived> operator*(const Scalar& scalar) const; + const CwiseUnaryOp, Derived> operator/(const Scalar& scalar) const; - friend const CwiseUnaryOp, Derived> + friend const CwiseUnaryOp, Derived> operator*(const Scalar& scalar, const MatrixBase& matrix) { return matrix*scalar; } @@ -318,14 +318,14 @@ template class MatrixBase const Product lazyProduct(const MatrixBase& other) const EIGEN_ALWAYS_INLINE; - const CwiseUnaryOp cwiseAbs() const; + const CwiseUnaryOp cwiseAbs() const; template - const CwiseBinaryOp + const CwiseBinaryOp cwiseProduct(const MatrixBase &other) const; template - const CwiseBinaryOp + const CwiseBinaryOp cwiseQuotient(const MatrixBase &other) const; //@} diff --git a/Eigen/src/Core/MatrixRef.h b/Eigen/src/Core/MatrixRef.h index 0d0f13f1c..2a5a1a514 100644 --- a/Eigen/src/Core/MatrixRef.h +++ b/Eigen/src/Core/MatrixRef.h @@ -42,7 +42,7 @@ template class MatrixRef { public: - EIGEN_BASIC_PUBLIC_INTERFACE(MatrixRef) + EIGEN_GENERIC_PUBLIC_INTERFACE(MatrixRef) MatrixRef(const MatrixType& matrix) : m_matrix(matrix) {} ~MatrixRef() {} diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/MatrixStorage.h index c8cb8b4eb..4bc0423f2 100644 --- a/Eigen/src/Core/MatrixStorage.h +++ b/Eigen/src/Core/MatrixStorage.h @@ -26,8 +26,7 @@ #ifndef EIGEN_MATRIXSTORAGE_H #define EIGEN_MATRIXSTORAGE_H - -/** \class MatrixStorage +/** \class ei_matrix_storage * * \brief Stores the data of a matrix * @@ -38,15 +37,15 @@ * * \sa Matrix */ -template class MatrixStorage; +template class ei_matrix_storage; // purely fixed-size matrix. -template class MatrixStorage +template class ei_matrix_storage { T m_data[Size]; public: - MatrixStorage() {} - MatrixStorage(int,int,int) {} + ei_matrix_storage() {} + ei_matrix_storage(int,int,int) {} static int rows(void) {return _Rows;} static int cols(void) {return _Cols;} void resize(int,int,int) {} @@ -55,14 +54,14 @@ template class MatrixStorage }; // dynamic-size matrix with fixed-size storage -template class MatrixStorage +template class ei_matrix_storage { T m_data[Size]; int m_rows; int m_cols; public: - MatrixStorage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {} - ~MatrixStorage() {} + ei_matrix_storage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {} + ~ei_matrix_storage() {} int rows(void) const {return m_rows;} int cols(void) const {return m_cols;} void resize(int, int rows, int cols) @@ -75,13 +74,13 @@ template class MatrixStorage }; // dynamic-size matrix with fixed-size storage and fixed width -template class MatrixStorage +template class ei_matrix_storage { T m_data[Size]; int m_rows; public: - MatrixStorage(int, int rows, int) : m_rows(rows) {} - ~MatrixStorage() {} + ei_matrix_storage(int, int rows, int) : m_rows(rows) {} + ~ei_matrix_storage() {} int rows(void) const {return m_rows;} int cols(void) const {return _Cols;} void resize(int size, int rows, int) @@ -93,13 +92,13 @@ template class MatrixStorage class MatrixStorage +template class ei_matrix_storage { T m_data[Size]; int m_cols; public: - MatrixStorage(int, int, int cols) : m_cols(cols) {} - ~MatrixStorage() {} + ei_matrix_storage(int, int, int cols) : m_cols(cols) {} + ~ei_matrix_storage() {} int rows(void) const {return _Rows;} int cols(void) const {return m_cols;} void resize(int size, int, int cols) @@ -111,15 +110,15 @@ template class MatrixStorage class MatrixStorage +template class ei_matrix_storage { T *m_data; int m_rows; int m_cols; public: - MatrixStorage(int size, int rows, int cols) + ei_matrix_storage(int size, int rows, int cols) : m_data(new T[size]), m_rows(rows), m_cols(cols) {} - ~MatrixStorage() { delete[] m_data; } + ~ei_matrix_storage() { delete[] m_data; } int rows(void) const {return m_rows;} int cols(void) const {return m_cols;} void resize(int size, int rows, int cols) @@ -137,13 +136,13 @@ template class MatrixStorage }; // matrix with dynamic width and fixed height (so that matrix has dynamic size). -template class MatrixStorage +template class ei_matrix_storage { T *m_data; int m_cols; public: - MatrixStorage(int size, int, int cols) : m_data(new T[size]), m_cols(cols) {} - ~MatrixStorage() { delete[] m_data; } + ei_matrix_storage(int size, int, int cols) : m_data(new T[size]), m_cols(cols) {} + ~ei_matrix_storage() { delete[] m_data; } static int rows(void) {return _Rows;} int cols(void) const {return m_cols;} void resize(int size, int, int cols) @@ -160,13 +159,13 @@ template class MatrixStorage }; // matrix with dynamic height and fixed width (so that matrix has dynamic size). -template class MatrixStorage +template class ei_matrix_storage { T *m_data; int m_rows; public: - MatrixStorage(int size, int rows, int) : m_data(new T[size]), m_rows(rows) {} - ~MatrixStorage() { delete[] m_data; } + ei_matrix_storage(int size, int rows, int) : m_data(new T[size]), m_rows(rows) {} + ~ei_matrix_storage() { delete[] m_data; } int rows(void) const {return m_rows;} static int cols(void) {return _Cols;} void resize(int size, int rows, int) diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h index bb957b16b..fbd6224aa 100644 --- a/Eigen/src/Core/Minor.h +++ b/Eigen/src/Core/Minor.h @@ -58,7 +58,7 @@ template class Minor { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Minor) + EIGEN_GENERIC_PUBLIC_INTERFACE(Minor) typedef typename MatrixType::AsArg MatRef; diff --git a/Eigen/src/Core/Ones.h b/Eigen/src/Core/Ones.h index 34bc3e8a7..836887c43 100644 --- a/Eigen/src/Core/Ones.h +++ b/Eigen/src/Core/Ones.h @@ -44,12 +44,12 @@ struct ei_traits > }; }; -template class Ones : NoOperatorEquals, +template class Ones : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Ones) + EIGEN_GENERIC_PUBLIC_INTERFACE(Ones) private: @@ -72,8 +72,8 @@ template class Ones : NoOperatorEquals, } protected: - const IntAtRunTimeIfDynamic m_rows; - const IntAtRunTimeIfDynamic m_cols; + const ei_int_if_dynamic m_rows; + const ei_int_if_dynamic m_cols; }; /** \returns an expression of a matrix where all coefficients equal one. diff --git a/Eigen/src/Core/OperatorEquals.h b/Eigen/src/Core/OperatorEquals.h index 42d8ed9ee..020296c2f 100644 --- a/Eigen/src/Core/OperatorEquals.h +++ b/Eigen/src/Core/OperatorEquals.h @@ -27,7 +27,7 @@ #define EIGEN_OPERATOREQUALS_H template -struct MatrixOperatorEqualsUnroller +struct ei_matrix_operator_equals_unroller { enum { col = (UnrollCount-1) / Derived1::RowsAtCompileTime, @@ -36,13 +36,13 @@ struct MatrixOperatorEqualsUnroller static void run(Derived1 &dst, const Derived2 &src) { - MatrixOperatorEqualsUnroller::run(dst, src); + ei_matrix_operator_equals_unroller::run(dst, src); dst.coeffRef(row, col) = src.coeff(row, col); } }; template -struct MatrixOperatorEqualsUnroller +struct ei_matrix_operator_equals_unroller { static void run(Derived1 &dst, const Derived2 &src) { @@ -52,38 +52,38 @@ struct MatrixOperatorEqualsUnroller // prevent buggy user code from causing an infinite recursion template -struct MatrixOperatorEqualsUnroller +struct ei_matrix_operator_equals_unroller { static void run(Derived1 &, const Derived2 &) {} }; template -struct MatrixOperatorEqualsUnroller +struct ei_matrix_operator_equals_unroller { static void run(Derived1 &, const Derived2 &) {} }; template -struct VectorOperatorEqualsUnroller +struct ei_vector_operator_equals_unroller { enum { index = UnrollCount - 1 }; static void run(Derived1 &dst, const Derived2 &src) { - VectorOperatorEqualsUnroller::run(dst, src); + ei_vector_operator_equals_unroller::run(dst, src); dst.coeffRef(index) = src.coeff(index); } }; // prevent buggy user code from causing an infinite recursion template -struct VectorOperatorEqualsUnroller +struct ei_vector_operator_equals_unroller { static void run(Derived1 &, const Derived2 &) {} }; template -struct VectorOperatorEqualsUnroller +struct ei_vector_operator_equals_unroller { static void run(Derived1 &dst, const Derived2 &src) { @@ -92,7 +92,7 @@ struct VectorOperatorEqualsUnroller }; template -struct VectorOperatorEqualsUnroller +struct ei_vector_operator_equals_unroller { static void run(Derived1 &, const Derived2 &) {} }; @@ -108,10 +108,10 @@ Derived& MatrixBase assert(size() == other.size()); if(EIGEN_UNROLLED_LOOPS && SizeAtCompileTime != Dynamic - && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL) - VectorOperatorEqualsUnroller + && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT) + ei_vector_operator_equals_unroller ::run + SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic>::run (*static_cast(this), *static_cast(&other)); else for(int i = 0; i < size(); i++) @@ -123,11 +123,11 @@ Derived& MatrixBase assert(rows() == other.rows() && cols() == other.cols()); if(EIGEN_UNROLLED_LOOPS && SizeAtCompileTime != Dynamic - && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL) + && SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT) { - MatrixOperatorEqualsUnroller + ei_matrix_operator_equals_unroller ::run + SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT ? SizeAtCompileTime : Dynamic>::run (*static_cast(this), *static_cast(&other)); } else diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index f0f412025..68f6da97f 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -26,18 +26,18 @@ #define EIGEN_PRODUCT_H template -struct ProductUnroller +struct ei_product_unroller { static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res) { - ProductUnroller::run(row, col, lhs, rhs, res); + ei_product_unroller::run(row, col, lhs, rhs, res); res += lhs.coeff(row, Index) * rhs.coeff(Index, col); } }; template -struct ProductUnroller<0, Size, Lhs, Rhs> +struct ei_product_unroller<0, Size, Lhs, Rhs> { static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res) @@ -47,14 +47,14 @@ struct ProductUnroller<0, Size, Lhs, Rhs> }; template -struct ProductUnroller +struct ei_product_unroller { static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; // prevent buggy user code from causing an infinite recursion template -struct ProductUnroller +struct ei_product_unroller { static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; @@ -84,12 +84,12 @@ struct ei_traits > }; }; -template class Product : NoOperatorEquals, +template class Product : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Product) + EIGEN_GENERIC_PUBLIC_INTERFACE(Product) typedef typename Lhs::AsArg LhsRef; typedef typename Rhs::AsArg RhsRef; @@ -111,9 +111,9 @@ template class Product : NoOperatorEquals, Scalar res; if(EIGEN_UNROLLED_LOOPS && Lhs::ColsAtCompileTime != Dynamic - && Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) - ProductUnroller ::run(row, col, m_lhs, m_rhs, res); else diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h index 1c2154b43..e560a708d 100644 --- a/Eigen/src/Core/Random.h +++ b/Eigen/src/Core/Random.h @@ -44,12 +44,12 @@ struct ei_traits > }; }; -template class Random : NoOperatorEquals, +template class Random : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Random) + EIGEN_GENERIC_PUBLIC_INTERFACE(Random) const Random& _asArg() const { return *this; } int _rows() const { return m_rows.value(); } @@ -70,8 +70,8 @@ template class Random : NoOperatorEquals, } protected: - const IntAtRunTimeIfDynamic m_rows; - const IntAtRunTimeIfDynamic m_cols; + const ei_int_if_dynamic m_rows; + const ei_int_if_dynamic m_cols; }; /** \returns a random matrix (not an expression, the matrix is immediately evaluated). diff --git a/Eigen/src/Core/Trace.h b/Eigen/src/Core/Trace.h index c106f0a9d..dcb317de5 100644 --- a/Eigen/src/Core/Trace.h +++ b/Eigen/src/Core/Trace.h @@ -25,16 +25,16 @@ #ifndef EIGEN_TRACE_H #define EIGEN_TRACE_H -template struct TraceUnroller +template struct ei_trace_unroller { static void run(const Derived &mat, typename Derived::Scalar &trace) { - TraceUnroller::run(mat, trace); + ei_trace_unroller::run(mat, trace); trace += mat.coeff(Index, Index); } }; -template struct TraceUnroller<0, Rows, Derived> +template struct ei_trace_unroller<0, Rows, Derived> { static void run(const Derived &mat, typename Derived::Scalar &trace) { @@ -42,13 +42,13 @@ template struct TraceUnroller<0, Rows, Derived> } }; -template struct TraceUnroller +template struct ei_trace_unroller { static void run(const Derived&, typename Derived::Scalar&) {} }; // prevent buggy user code from causing an infinite recursion -template struct TraceUnroller +template struct ei_trace_unroller { static void run(const Derived&, typename Derived::Scalar&) {} }; @@ -64,9 +64,9 @@ MatrixBase::trace() const Scalar res; if(EIGEN_UNROLLED_LOOPS && RowsAtCompileTime != Dynamic - && RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) - TraceUnroller + && RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT) + ei_trace_unroller ::run(*static_cast(this), res); else { diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 8f802818f..d6613989e 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -54,7 +54,7 @@ template class Transpose { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Transpose) + EIGEN_GENERIC_PUBLIC_INTERFACE(Transpose) typedef typename MatrixType::AsArg MatRef; @@ -108,9 +108,9 @@ MatrixBase::transpose() const * Example: \include MatrixBase_adjoint.cpp * Output: \verbinclude MatrixBase_adjoint.out * - * \sa transpose(), conjugate(), class Transpose, class ScalarConjugateOp */ + * \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */ template -const Transpose > +const Transpose > MatrixBase::adjoint() const { return conjugate().transpose(); diff --git a/Eigen/src/Core/Util.h b/Eigen/src/Core/Util.h index 5b93c3f78..3c970d6e8 100644 --- a/Eigen/src/Core/Util.h +++ b/Eigen/src/Core/Util.h @@ -31,18 +31,9 @@ #define EIGEN_UNROLLED_LOOPS (true) #endif -/** Defines the maximal loop size (i.e., the matrix size NxM) to enable - * meta unrolling of operator=. - */ -#ifndef EIGEN_UNROLLING_LIMIT_OPEQUAL -#define EIGEN_UNROLLING_LIMIT_OPEQUAL 25 -#endif - -/** Defines the maximal loop size to enable meta unrolling - * of the matrix product, dot product and trace. - */ -#ifndef EIGEN_UNROLLING_LIMIT_PRODUCT -#define EIGEN_UNROLLING_LIMIT_PRODUCT 16 +/** Defines the maximal loop size to enable meta unrolling of loops */ +#ifndef EIGEN_UNROLLING_LIMIT +#define EIGEN_UNROLLING_LIMIT 16 #endif #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR @@ -105,20 +96,20 @@ EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=) -#define _EIGEN_BASIC_PUBLIC_INTERFACE(Derived, BaseClass) \ -friend class MatrixBase; \ +#define _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, BaseClass) \ typedef BaseClass Base; \ typedef typename ei_traits::Scalar Scalar; \ -enum { RowsAtCompileTime = ei_traits::RowsAtCompileTime, \ - ColsAtCompileTime = ei_traits::ColsAtCompileTime, \ - MaxRowsAtCompileTime = ei_traits::MaxRowsAtCompileTime, \ - MaxColsAtCompileTime = ei_traits::MaxColsAtCompileTime }; \ +using Base::RowsAtCompileTime; \ +using Base::ColsAtCompileTime; \ +using Base::MaxRowsAtCompileTime; \ +using Base::MaxColsAtCompileTime; \ using Base::SizeAtCompileTime; \ using Base::MaxSizeAtCompileTime; \ using Base::IsVectorAtCompileTime; -#define EIGEN_BASIC_PUBLIC_INTERFACE(Derived) \ -_EIGEN_BASIC_PUBLIC_INTERFACE(Derived, MatrixBase) +#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ +_EIGEN_GENERIC_PUBLIC_INTERFACE(Derived, MatrixBase) \ +friend class MatrixBase; #define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b) @@ -130,34 +121,34 @@ enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight }; // just a workaround because GCC seems to not really like empty structs #ifdef __GNUG__ - struct EiEmptyStruct{char _ei_dummy_;}; - #define EIGEN_EMPTY_STRUCT : Eigen::EiEmptyStruct + struct ei_empty_struct{char _ei_dummy_;}; + #define EIGEN_EMPTY_STRUCT : Eigen::ei_empty_struct #else #define EIGEN_EMPTY_STRUCT #endif -//classes inheriting NoOperatorEquals don't generate a default operator=. -class NoOperatorEquals +//classes inheriting ei_no_assignment_operator don't generate a default operator=. +class ei_no_assignment_operator { private: - NoOperatorEquals& operator=(const NoOperatorEquals&); + ei_no_assignment_operator& operator=(const ei_no_assignment_operator&); }; -template class IntAtRunTimeIfDynamic EIGEN_EMPTY_STRUCT +template class ei_int_if_dynamic EIGEN_EMPTY_STRUCT { public: - IntAtRunTimeIfDynamic() {} - explicit IntAtRunTimeIfDynamic(int) {} + ei_int_if_dynamic() {} + explicit ei_int_if_dynamic(int) {} static int value() { return Value; } void setValue(int) {} }; -template<> class IntAtRunTimeIfDynamic +template<> class ei_int_if_dynamic { int m_value; - IntAtRunTimeIfDynamic() {} + ei_int_if_dynamic() {} public: - explicit IntAtRunTimeIfDynamic(int value) : m_value(value) {} + explicit ei_int_if_dynamic(int value) : m_value(value) {} int value() const { return m_value; } void setValue(int value) { m_value = value; } }; diff --git a/Eigen/src/Core/Zero.h b/Eigen/src/Core/Zero.h index 7848bb048..3c9fbf533 100644 --- a/Eigen/src/Core/Zero.h +++ b/Eigen/src/Core/Zero.h @@ -44,12 +44,12 @@ struct ei_traits > }; }; -template class Zero : NoOperatorEquals, +template class Zero : ei_no_assignment_operator, public MatrixBase > { public: - EIGEN_BASIC_PUBLIC_INTERFACE(Zero) + EIGEN_GENERIC_PUBLIC_INTERFACE(Zero) private: @@ -73,8 +73,8 @@ template class Zero : NoOperatorEquals, } protected: - const IntAtRunTimeIfDynamic m_rows; - const IntAtRunTimeIfDynamic m_cols; + const ei_int_if_dynamic m_rows; + const ei_int_if_dynamic m_cols; }; /** \returns an expression of a zero matrix. diff --git a/bench/bench_unrolling b/bench/bench_unrolling index 4af791412..7934031a8 100755 --- a/bench/bench_unrolling +++ b/bench/bench_unrolling @@ -5,7 +5,7 @@ for ((i=1; i<16; ++i)); do echo "Matrix size: $i x $i :" - $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT_OPEQUAL=1024 -DEIGEN_UNROLLING_LIMIT_PRODUCT=25 -o benchmark && time ./benchmark >/dev/null + $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=1024 -DEIGEN_UNROLLING_LIMIT=25 -o benchmark && time ./benchmark >/dev/null $CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null echo " " done diff --git a/doc/examples/class_Cast.cpp b/doc/examples/class_Cast.cpp index 68b8d2437..7e752be1b 100644 --- a/doc/examples/class_Cast.cpp +++ b/doc/examples/class_Cast.cpp @@ -4,14 +4,14 @@ using namespace std; template const Eigen::CwiseUnaryOp< - Eigen::ScalarCastOp< - typename Eigen::NumTraits::FloatingPoint + Eigen::ei_scalar_cast_op< + typename Eigen::ei_traits::FloatingPoint >, Derived > castToFloatingPoint(const MatrixBase& m) { return m.template cast< - typename Eigen::NumTraits< + typename Eigen::ei_traits< typename Derived::Scalar >::FloatingPoint >(); diff --git a/test/submatrices.cpp b/test/submatrices.cpp index cba88bda6..640a0fba6 100644 --- a/test/submatrices.cpp +++ b/test/submatrices.cpp @@ -28,7 +28,7 @@ namespace Eigen { // check minor separately in order to avoid the possible creation of a zero-sized // array. Comes from a compilation error with gcc-3.4 or gcc-4 with -ansi -pedantic. -// Another solution would be to declare the array like this: T m_data[Size==0?1:Size]; in MatrixStorage +// Another solution would be to declare the array like this: T m_data[Size==0?1:Size]; in ei_matrix_storage // but this is probably not bad to raise such an error at compile time... template struct CheckMinor { -- cgit v1.2.3