diff options
Diffstat (limited to 'Eigen/src')
27 files changed, 406 insertions, 395 deletions
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h index ad62b209b..bf57b3754 100644 --- a/Eigen/src/Core/Assign.h +++ b/Eigen/src/Core/Assign.h @@ -35,7 +35,7 @@ struct ei_matrix_assignment_unroller row = (UnrollCount-1) % Derived1::RowsAtCompileTime }; - static void run(Derived1 &dst, const Derived2 &src) + inline static void run(Derived1 &dst, const Derived2 &src) { ei_matrix_assignment_unroller<Derived1, Derived2, UnrollCount-1>::run(dst, src); dst.coeffRef(row, col) = src.coeff(row, col); @@ -45,7 +45,7 @@ struct ei_matrix_assignment_unroller template<typename Derived1, typename Derived2> struct ei_matrix_assignment_unroller<Derived1, Derived2, 1> { - static void run(Derived1 &dst, const Derived2 &src) + inline static void run(Derived1 &dst, const Derived2 &src) { dst.coeffRef(0, 0) = src.coeff(0, 0); } @@ -55,13 +55,13 @@ struct ei_matrix_assignment_unroller<Derived1, Derived2, 1> template<typename Derived1, typename Derived2> struct ei_matrix_assignment_unroller<Derived1, Derived2, 0> { - static void run(Derived1 &, const Derived2 &) {} + inline static void run(Derived1 &, const Derived2 &) {} }; template<typename Derived1, typename Derived2> struct ei_matrix_assignment_unroller<Derived1, Derived2, Dynamic> { - static void run(Derived1 &, const Derived2 &) {} + inline static void run(Derived1 &, const Derived2 &) {} }; //---- @@ -74,7 +74,7 @@ struct ei_matrix_assignment_packet_unroller col = Derived1::Flags&RowMajorBit ? Index % Derived1::ColsAtCompileTime : Index / Derived1::RowsAtCompileTime }; - static void run(Derived1 &dst, const Derived2 &src) + inline static void run(Derived1 &dst, const Derived2 &src) { ei_matrix_assignment_packet_unroller<Derived1, Derived2, Index-ei_packet_traits<typename Derived1::Scalar>::size>::run(dst, src); @@ -85,7 +85,7 @@ struct ei_matrix_assignment_packet_unroller template<typename Derived1, typename Derived2> struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, 0 > { - static void run(Derived1 &dst, const Derived2 &src) + inline static void run(Derived1 &dst, const Derived2 &src) { dst.template writePacketCoeff<Aligned>(0, 0, src.template packetCoeff<Aligned>(0, 0)); } @@ -94,7 +94,8 @@ struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, 0 > template<typename Derived1, typename Derived2> struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, Dynamic> { - static void run(Derived1 &, const Derived2 &) { ei_internal_assert(false && "ei_matrix_assignment_packet_unroller"); } + inline static void run(Derived1 &, const Derived2 &) + { ei_internal_assert(false && "ei_matrix_assignment_packet_unroller"); } }; template <typename Derived, typename OtherDerived, @@ -109,7 +110,7 @@ struct ei_assignment_impl; template<typename Derived> template<typename OtherDerived> -Derived& MatrixBase<Derived> +inline Derived& MatrixBase<Derived> ::lazyAssign(const MatrixBase<OtherDerived>& other) { // std::cout << typeid(OtherDerived).name() << "\n"; @@ -121,7 +122,7 @@ Derived& MatrixBase<Derived> template<typename Derived> template<typename OtherDerived> -Derived& MatrixBase<Derived> +inline Derived& MatrixBase<Derived> ::operator=(const MatrixBase<OtherDerived>& other) { const bool need_to_transpose = Derived::IsVectorAtCompileTime diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 4b417224c..125ae3979 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -85,7 +85,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block /** Column or Row constructor */ - Block(const MatrixType& matrix, int i) + inline Block(const MatrixType& matrix, int i) : m_matrix(matrix), // It is a row if and only if BlockRows==1 and BlockCols==MatrixType::ColsAtCompileTime, // and it is a column if and only if BlockRows==MatrixType::RowsAtCompileTime and BlockCols==1, @@ -103,7 +103,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block /** Fixed-size constructor */ - Block(const MatrixType& matrix, int startRow, int startCol) + inline Block(const MatrixType& matrix, int startRow, int startCol) : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol) { ei_assert(RowsAtCompileTime!=Dynamic && RowsAtCompileTime!=Dynamic); @@ -113,7 +113,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block /** Dynamic-size constructor */ - Block(const MatrixType& matrix, + inline Block(const MatrixType& matrix, int startRow, int startCol, int blockRows, int blockCols) : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol), @@ -129,30 +129,30 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block private: - int _rows() const { return m_blockRows.value(); } - int _cols() const { return m_blockCols.value(); } + inline int _rows() const { return m_blockRows.value(); } + inline int _cols() const { return m_blockCols.value(); } - int _stride(void) const { return m_matrix.stride(); } + inline int _stride(void) const { return m_matrix.stride(); } - Scalar& _coeffRef(int row, int col) + inline Scalar& _coeffRef(int row, int col) { return m_matrix.const_cast_derived() .coeffRef(row + m_startRow.value(), col + m_startCol.value()); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value()); } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline PacketScalar _packetCoeff(int row, int col) const { return m_matrix.template packetCoeff<UnAligned>(row + m_startRow.value(), col + m_startCol.value()); } template<int LoadMode> - void _writePacketCoeff(int row, int col, const PacketScalar& x) + inline void _writePacketCoeff(int row, int col, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacketCoeff<UnAligned>(row + m_startRow.value(), col + m_startCol.value(), x); } @@ -183,7 +183,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block * \sa class Block, block(int,int) */ template<typename Derived> -Block<Derived> MatrixBase<Derived> +inline Block<Derived> MatrixBase<Derived> ::block(int startRow, int startCol, int blockRows, int blockCols) { return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols); @@ -191,7 +191,7 @@ Block<Derived> MatrixBase<Derived> /** This is the const version of block(int,int,int,int). */ template<typename Derived> -const Block<Derived> MatrixBase<Derived> +inline const Block<Derived> MatrixBase<Derived> ::block(int startRow, int startCol, int blockRows, int blockCols) const { return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols); @@ -214,7 +214,7 @@ const Block<Derived> MatrixBase<Derived> * \sa class Block, block(int) */ template<typename Derived> -Block<Derived> MatrixBase<Derived> +inline Block<Derived> MatrixBase<Derived> ::block(int start, int size) { ei_assert(IsVectorAtCompileTime); @@ -226,7 +226,7 @@ Block<Derived> MatrixBase<Derived> /** This is the const version of block(int,int).*/ template<typename Derived> -const Block<Derived> MatrixBase<Derived> +inline const Block<Derived> MatrixBase<Derived> ::block(int start, int size) const { ei_assert(IsVectorAtCompileTime); @@ -252,7 +252,7 @@ const Block<Derived> MatrixBase<Derived> * \sa class Block, block(int,int) */ template<typename Derived> -Block<Derived> MatrixBase<Derived>::start(int size) +inline Block<Derived> MatrixBase<Derived>::start(int size) { ei_assert(IsVectorAtCompileTime); return Block<Derived>(derived(), 0, 0, @@ -262,7 +262,7 @@ Block<Derived> MatrixBase<Derived>::start(int size) /** This is the const version of start(int).*/ template<typename Derived> -const Block<Derived> MatrixBase<Derived>::start(int size) const +inline const Block<Derived> MatrixBase<Derived>::start(int size) const { ei_assert(IsVectorAtCompileTime); return Block<Derived>(derived(), 0, 0, @@ -286,7 +286,7 @@ const Block<Derived> MatrixBase<Derived>::start(int size) const * \sa class Block, block(int,int) */ template<typename Derived> -Block<Derived> MatrixBase<Derived>::end(int size) +inline Block<Derived> MatrixBase<Derived>::end(int size) { ei_assert(IsVectorAtCompileTime); return Block<Derived>(derived(), @@ -298,7 +298,7 @@ Block<Derived> MatrixBase<Derived>::end(int size) /** This is the const version of end(int).*/ template<typename Derived> -const Block<Derived> MatrixBase<Derived>::end(int size) const +inline const Block<Derived> MatrixBase<Derived>::end(int size) const { ei_assert(IsVectorAtCompileTime); return Block<Derived>(derived(), @@ -321,8 +321,8 @@ const Block<Derived> MatrixBase<Derived>::end(int size) const */ template<typename Derived> template<int Size> -Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, - ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> +inline Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, + ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> MatrixBase<Derived>::start() { ei_assert(IsVectorAtCompileTime); @@ -333,8 +333,8 @@ MatrixBase<Derived>::start() /** This is the const version of start<int>().*/ template<typename Derived> template<int Size> -const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, - ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> +inline const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, + ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> MatrixBase<Derived>::start() const { ei_assert(IsVectorAtCompileTime); @@ -355,8 +355,8 @@ MatrixBase<Derived>::start() const */ template<typename Derived> template<int Size> -Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, - ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> +inline Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, + ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> MatrixBase<Derived>::end() { ei_assert(IsVectorAtCompileTime); @@ -370,8 +370,8 @@ MatrixBase<Derived>::end() /** This is the const version of end<int>.*/ template<typename Derived> template<int Size> -const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, - ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> +inline const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, + ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> MatrixBase<Derived>::end() const { ei_assert(IsVectorAtCompileTime); @@ -399,7 +399,7 @@ MatrixBase<Derived>::end() const * \sa class Block, block(int,int,int,int) */ template<typename Derived> -Block<Derived> MatrixBase<Derived> +inline Block<Derived> MatrixBase<Derived> ::corner(CornerType type, int cRows, int cCols) { switch(type) @@ -419,7 +419,7 @@ Block<Derived> MatrixBase<Derived> /** This is the const version of corner(CornerType, int, int).*/ template<typename Derived> -const Block<Derived> MatrixBase<Derived> +inline const Block<Derived> MatrixBase<Derived> ::corner(CornerType type, int cRows, int cCols) const { switch(type) @@ -451,7 +451,7 @@ const Block<Derived> MatrixBase<Derived> */ template<typename Derived> template<int CRows, int CCols> -Block<Derived, CRows, CCols> MatrixBase<Derived> +inline Block<Derived, CRows, CCols> MatrixBase<Derived> ::corner(CornerType type) { switch(type) @@ -472,7 +472,7 @@ Block<Derived, CRows, CCols> MatrixBase<Derived> /** This is the const version of corner<int, int>(CornerType).*/ template<typename Derived> template<int CRows, int CCols> -const Block<Derived, CRows, CCols> MatrixBase<Derived> +inline const Block<Derived, CRows, CCols> MatrixBase<Derived> ::corner(CornerType type) const { switch(type) @@ -508,7 +508,7 @@ const Block<Derived, CRows, CCols> MatrixBase<Derived> */ template<typename Derived> template<int BlockRows, int BlockCols> -Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> +inline Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> ::block(int startRow, int startCol) { return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); @@ -517,7 +517,7 @@ Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> /** This is the const version of block<>(int, int). */ template<typename Derived> template<int BlockRows, int BlockCols> -const Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> +inline const Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> ::block(int startRow, int startCol) const { return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); @@ -530,7 +530,7 @@ const Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> * * \sa row(), class Block */ template<typename Derived> -Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> +inline Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> MatrixBase<Derived>::col(int i) { return Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>(derived(), i); @@ -538,7 +538,7 @@ MatrixBase<Derived>::col(int i) /** This is the const version of col(). */ template<typename Derived> -const Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> +inline const Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> MatrixBase<Derived>::col(int i) const { return Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>(derived(), i); @@ -551,7 +551,7 @@ MatrixBase<Derived>::col(int i) const * * \sa col(), class Block */ template<typename Derived> -Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> +inline Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> MatrixBase<Derived>::row(int i) { return Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>(derived(), i); @@ -559,7 +559,7 @@ MatrixBase<Derived>::row(int i) /** This is the const version of row(). */ template<typename Derived> -const Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> +inline const Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> MatrixBase<Derived>::row(int i) const { return Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>(derived(), i); diff --git a/Eigen/src/Core/Coeffs.h b/Eigen/src/Core/Coeffs.h index 8e298de7d..28845cd95 100644 --- a/Eigen/src/Core/Coeffs.h +++ b/Eigen/src/Core/Coeffs.h @@ -40,7 +40,7 @@ * \sa operator()(int,int) const, coeffRef(int,int), coeff(int) const */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::coeff(int row, int col) const { ei_internal_assert(row >= 0 && row < rows() @@ -53,7 +53,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived> * \sa operator()(int,int), operator[](int) const */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::operator()(int row, int col) const { ei_assert(row >= 0 && row < rows() @@ -76,7 +76,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived> * \sa operator()(int,int), coeff(int, int) const, coeffRef(int) */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::coeffRef(int row, int col) { ei_internal_assert(row >= 0 && row < rows() @@ -89,7 +89,7 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived> * \sa operator()(int,int) const, operator[](int) */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::operator()(int row, int col) { ei_assert(row >= 0 && row < rows() @@ -112,7 +112,7 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived> * \sa operator[](int) const, coeffRef(int), coeff(int,int) const */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::coeff(int index) const { ei_internal_assert(IsVectorAtCompileTime); @@ -136,7 +136,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived> * z() const, w() const */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::operator[](int index) const { ei_assert(IsVectorAtCompileTime); @@ -167,7 +167,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived> * \sa operator[](int), coeff(int) const, coeffRef(int,int) */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::coeffRef(int index) { ei_internal_assert(IsVectorAtCompileTime); @@ -190,7 +190,7 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived> * \sa operator[](int) const, operator()(int,int), x(), y(), z(), w() */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::operator[](int index) { ei_assert(IsVectorAtCompileTime); @@ -208,42 +208,55 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived> /** equivalent to operator[](0). \only_for_vectors */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::x() const { return (*this)[0]; } /** equivalent to operator[](1). \only_for_vectors */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::y() const { return (*this)[1]; } /** equivalent to operator[](2). \only_for_vectors */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::z() const { return (*this)[2]; } /** equivalent to operator[](3). \only_for_vectors */ template<typename Derived> -const typename ei_traits<Derived>::Scalar MatrixBase<Derived> +inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::w() const { return (*this)[3]; } /** equivalent to operator[](0). \only_for_vectors */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::x() { return (*this)[0]; } /** equivalent to operator[](1). \only_for_vectors */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::y() { return (*this)[1]; } /** equivalent to operator[](2). \only_for_vectors */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::z() { return (*this)[2]; } /** equivalent to operator[](3). \only_for_vectors */ template<typename Derived> -typename ei_traits<Derived>::Scalar& MatrixBase<Derived> +inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::w() { return (*this)[3]; } +template<typename Derived> +template<int LoadMode> +inline typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type +MatrixBase<Derived>::packetCoeff(int row, int col) const +{ return derived().template _packetCoeff<LoadMode>(row,col); } + +template<typename Derived> +template<int StoreMode> +inline void MatrixBase<Derived>::writePacketCoeff +(int row, int col, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x) +{ return derived().template _writePacketCoeff<StoreMode>(row,col,x); } + + #endif // EIGEN_COEFFS_H diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index 21551ccf2..d5e25b6e4 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -32,14 +32,14 @@ template<typename Derived> struct MatrixBase<Derived>::CommaInitializer { - CommaInitializer(Derived& mat, const Scalar& s) + inline CommaInitializer(Derived& mat, const Scalar& s) : m_matrix(mat), m_row(0), m_col(1), m_currentBlockRows(1) { m_matrix.coeffRef(0,0) = s; } template<typename OtherDerived> - CommaInitializer(Derived& mat, const MatrixBase<OtherDerived>& other) + inline CommaInitializer(Derived& mat, const MatrixBase<OtherDerived>& other) : m_matrix(mat), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) { m_matrix.block(0, 0, other.rows(), other.cols()) = other; @@ -86,7 +86,7 @@ struct MatrixBase<Derived>::CommaInitializer return *this; } - ~CommaInitializer(void) + inline ~CommaInitializer() { ei_assert((m_row+m_currentBlockRows) == m_matrix.rows() && m_col == m_matrix.cols() @@ -108,14 +108,14 @@ struct MatrixBase<Derived>::CommaInitializer * Output: \verbinclude MatrixBase_set.out */ template<typename Derived> -typename MatrixBase<Derived>::CommaInitializer MatrixBase<Derived>::operator<< (const Scalar& s) +inline typename MatrixBase<Derived>::CommaInitializer MatrixBase<Derived>::operator<< (const Scalar& s) { return CommaInitializer(*static_cast<Derived*>(this), s); } template<typename Derived> template<typename OtherDerived> -typename MatrixBase<Derived>::CommaInitializer +inline typename MatrixBase<Derived>::CommaInitializer MatrixBase<Derived>::operator<<(const MatrixBase<OtherDerived>& other) { return CommaInitializer(*static_cast<Derived *>(this), other); diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 31afbe0f1..daa81ddb7 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -87,7 +87,7 @@ class CwiseBinaryOp : ei_no_assignment_operator, typedef typename ei_traits<CwiseBinaryOp>::LhsNested LhsNested; typedef typename ei_traits<CwiseBinaryOp>::RhsNested RhsNested; - CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) + inline CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) : m_lhs(lhs), m_rhs(rhs), m_functor(func) { ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); @@ -95,16 +95,16 @@ class CwiseBinaryOp : ei_no_assignment_operator, private: - int _rows() const { return m_lhs.rows(); } - int _cols() const { return m_lhs.cols(); } + inline int _rows() const { return m_lhs.rows(); } + inline int _cols() const { return m_lhs.cols(); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_functor(m_lhs.coeff(row, col), m_rhs.coeff(row, col)); } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline PacketScalar _packetCoeff(int row, int col) const { return m_functor.packetOp(m_lhs.template packetCoeff<LoadMode>(row, col), m_rhs.template packetCoeff<LoadMode>(row, col)); } @@ -121,8 +121,8 @@ class CwiseBinaryOp : ei_no_assignment_operator, */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>, - Derived, OtherDerived> +inline const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>, + Derived, OtherDerived> MatrixBase<Derived>::operator-(const MatrixBase<OtherDerived> &other) const { return CwiseBinaryOp<ei_scalar_difference_op<Scalar>, @@ -135,7 +135,7 @@ MatrixBase<Derived>::operator-(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -Derived & +inline Derived & MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other) { return *this = *this - other; @@ -149,7 +149,7 @@ MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other) */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::operator+(const MatrixBase<OtherDerived> &other) const { return CwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); @@ -161,7 +161,7 @@ MatrixBase<Derived>::operator+(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -Derived & +inline Derived & MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) { return *this = *this + other; @@ -173,7 +173,7 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<ei_scalar_product_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<ei_scalar_product_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const { return CwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); @@ -185,7 +185,7 @@ MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<ei_scalar_quotient_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<ei_scalar_quotient_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const { return CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); @@ -197,7 +197,7 @@ MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<ei_scalar_min_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<ei_scalar_min_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseMin(const MatrixBase<OtherDerived> &other) const { return CwiseBinaryOp<ei_scalar_min_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); @@ -209,7 +209,7 @@ MatrixBase<Derived>::cwiseMin(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<ei_scalar_max_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<ei_scalar_max_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseMax(const MatrixBase<OtherDerived> &other) const { return CwiseBinaryOp<ei_scalar_max_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); @@ -224,7 +224,7 @@ MatrixBase<Derived>::cwiseMax(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename CustomBinaryOp, typename OtherDerived> -const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived> +inline const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived> MatrixBase<Derived>::cwise(const MatrixBase<OtherDerived> &other, const CustomBinaryOp& func) const { return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(derived(), other.derived(), func); @@ -236,7 +236,7 @@ MatrixBase<Derived>::cwise(const MatrixBase<OtherDerived> &other, const CustomBi */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<std::less<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<std::less<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseLessThan(const MatrixBase<OtherDerived> &other) const { return cwise(other, std::less<Scalar>()); @@ -248,7 +248,7 @@ MatrixBase<Derived>::cwiseLessThan(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<std::less_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<std::less_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseLessEqual(const MatrixBase<OtherDerived> &other) const { return cwise(other, std::less_equal<Scalar>()); @@ -260,7 +260,7 @@ MatrixBase<Derived>::cwiseLessEqual(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<std::greater<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<std::greater<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseGreaterThan(const MatrixBase<OtherDerived> &other) const { return cwise(other, std::greater<Scalar>()); @@ -272,7 +272,7 @@ MatrixBase<Derived>::cwiseGreaterThan(const MatrixBase<OtherDerived> &other) con */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<std::greater_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<std::greater_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseGreaterEqual(const MatrixBase<OtherDerived> &other) const { return cwise(other, std::greater_equal<Scalar>()); @@ -284,7 +284,7 @@ MatrixBase<Derived>::cwiseGreaterEqual(const MatrixBase<OtherDerived> &other) co */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<std::equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<std::equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseEqualTo(const MatrixBase<OtherDerived> &other) const { return cwise(other, std::equal_to<Scalar>()); @@ -296,7 +296,7 @@ MatrixBase<Derived>::cwiseEqualTo(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<std::not_equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> +inline const CwiseBinaryOp<std::not_equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> MatrixBase<Derived>::cwiseNotEqualTo(const MatrixBase<OtherDerived> &other) const { return cwise(other, std::not_equal_to<Scalar>()); diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index bcc09d0c8..ee986de48 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -440,7 +440,7 @@ Derived& MatrixBase<Derived>::setOnes() * \sa ei_random(), ei_random(int) */ template<typename Derived> -const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::random(int rows, int cols) { return create(rows, cols, ei_scalar_random_op<Scalar>()); @@ -463,7 +463,7 @@ MatrixBase<Derived>::random(int rows, int cols) * \sa ei_random(), ei_random(int,int) */ template<typename Derived> -const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::random(int size) { return create(size, ei_scalar_random_op<Scalar>()); @@ -481,7 +481,7 @@ MatrixBase<Derived>::random(int size) * \sa ei_random(int), ei_random(int,int) */ template<typename Derived> -const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::random() { return create(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_random_op<Scalar>()); @@ -495,7 +495,7 @@ MatrixBase<Derived>::random() * \sa class CwiseNullaryOp, ei_random() */ template<typename Derived> -Derived& MatrixBase<Derived>::setRandom() +inline Derived& MatrixBase<Derived>::setRandom() { return *this = random(rows(), cols()); } @@ -517,7 +517,7 @@ Derived& MatrixBase<Derived>::setRandom() * \sa identity(), setIdentity(), isIdentity() */ template<typename Derived> -const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::identity(int rows, int cols) { return create(rows, cols, ei_scalar_identity_op<Scalar>()); @@ -534,7 +534,7 @@ MatrixBase<Derived>::identity(int rows, int cols) * \sa identity(int,int), setIdentity(), isIdentity() */ template<typename Derived> -const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::identity() { return create(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_identity_op<Scalar>()); @@ -580,7 +580,7 @@ bool MatrixBase<Derived>::isIdentity * \sa class CwiseNullaryOp, identity(), identity(int,int), isIdentity() */ template<typename Derived> -Derived& MatrixBase<Derived>::setIdentity() +inline Derived& MatrixBase<Derived>::setIdentity() { return *this = identity(rows(), cols()); } diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index 438417829..d7a415d48 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -69,21 +69,21 @@ class CwiseUnaryOp : ei_no_assignment_operator, EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) - CwiseUnaryOp(const MatrixType& mat, const UnaryOp& func = UnaryOp()) + inline CwiseUnaryOp(const MatrixType& mat, const UnaryOp& func = UnaryOp()) : m_matrix(mat), m_functor(func) {} private: - int _rows() const { return m_matrix.rows(); } - int _cols() const { return m_matrix.cols(); } + inline int _rows() const { return m_matrix.rows(); } + inline int _cols() const { return m_matrix.cols(); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_functor(m_matrix.coeff(row, col)); } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline PacketScalar _packetCoeff(int row, int col) const { return m_functor.packetOp(m_matrix.template packetCoeff<LoadMode>(row, col)); } @@ -105,7 +105,7 @@ class CwiseUnaryOp : ei_no_assignment_operator, */ template<typename Derived> template<typename CustomUnaryOp> -const CwiseUnaryOp<CustomUnaryOp, Derived> +inline const CwiseUnaryOp<CustomUnaryOp, Derived> MatrixBase<Derived>::cwise(const CustomUnaryOp& func) const { return CwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func); @@ -114,7 +114,7 @@ MatrixBase<Derived>::cwise(const CustomUnaryOp& func) const /** \returns an expression of the opposite of \c *this */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived> +inline const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived> MatrixBase<Derived>::operator-() const { return CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, Derived>(derived()); @@ -123,7 +123,7 @@ MatrixBase<Derived>::operator-() const /** \returns an expression of the coefficient-wise absolute value of \c *this */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_abs_op<typename ei_traits<Derived>::Scalar>,Derived> +inline const CwiseUnaryOp<ei_scalar_abs_op<typename ei_traits<Derived>::Scalar>,Derived> MatrixBase<Derived>::cwiseAbs() const { return CwiseUnaryOp<ei_scalar_abs_op<Scalar>,Derived>(derived()); @@ -132,7 +132,7 @@ MatrixBase<Derived>::cwiseAbs() const /** \returns an expression of the coefficient-wise squared absolute value of \c *this */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_abs2_op<typename ei_traits<Derived>::Scalar>,Derived> +inline const CwiseUnaryOp<ei_scalar_abs2_op<typename ei_traits<Derived>::Scalar>,Derived> MatrixBase<Derived>::cwiseAbs2() const { return CwiseUnaryOp<ei_scalar_abs2_op<Scalar>,Derived>(derived()); @@ -142,7 +142,7 @@ MatrixBase<Derived>::cwiseAbs2() const * * \sa adjoint() */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::conjugate() const { return CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>(derived()); @@ -157,7 +157,7 @@ MatrixBase<Derived>::conjugate() const */ template<typename Derived> template<typename NewType> -const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> +inline const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> MatrixBase<Derived>::cast() const { return CwiseUnaryOp<ei_scalar_cast_op<Scalar, NewType>, Derived>(derived()); @@ -165,7 +165,7 @@ MatrixBase<Derived>::cast() const /** \relates MatrixBase */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::operator*(const Scalar& scalar) const { return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> @@ -174,7 +174,7 @@ MatrixBase<Derived>::operator*(const Scalar& scalar) const /** \relates MatrixBase */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::operator/(const Scalar& scalar) const { return CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived> @@ -182,14 +182,14 @@ MatrixBase<Derived>::operator/(const Scalar& scalar) const } template<typename Derived> -Derived& +inline Derived& MatrixBase<Derived>::operator*=(const Scalar& other) { return *this = *this * other; } template<typename Derived> -Derived& +inline Derived& MatrixBase<Derived>::operator/=(const Scalar& other) { return *this = *this / other; @@ -197,7 +197,7 @@ MatrixBase<Derived>::operator/=(const Scalar& other) /** \returns an expression of the coefficient-wise square root of *this. */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_sqrt_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_sqrt_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::cwiseSqrt() const { return CwiseUnaryOp<ei_scalar_sqrt_op<Scalar>, Derived>(derived()); @@ -205,7 +205,7 @@ MatrixBase<Derived>::cwiseSqrt() const /** \returns an expression of the coefficient-wise exponential of *this. */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_exp_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_exp_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::cwiseExp() const { return CwiseUnaryOp<ei_scalar_exp_op<Scalar>, Derived>(derived()); @@ -213,7 +213,7 @@ MatrixBase<Derived>::cwiseExp() const /** \returns an expression of the coefficient-wise logarithm of *this. */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_log_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_log_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::cwiseLog() const { return CwiseUnaryOp<ei_scalar_log_op<Scalar>, Derived>(derived()); @@ -221,7 +221,7 @@ MatrixBase<Derived>::cwiseLog() const /** \returns an expression of the coefficient-wise cosine of *this. */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_cos_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_cos_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::cwiseCos() const { return CwiseUnaryOp<ei_scalar_cos_op<Scalar>, Derived>(derived()); @@ -229,7 +229,7 @@ MatrixBase<Derived>::cwiseCos() const /** \returns an expression of the coefficient-wise sine of *this. */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_sin_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_sin_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::cwiseSin() const { return CwiseUnaryOp<ei_scalar_sin_op<Scalar>, Derived>(derived()); @@ -237,7 +237,7 @@ MatrixBase<Derived>::cwiseSin() const /** \relates MatrixBase */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_pow_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_pow_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::cwisePow(const Scalar& exponent) const { return CwiseUnaryOp<ei_scalar_pow_op<Scalar>, Derived> diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h index 635d847f7..b9471e7a1 100644 --- a/Eigen/src/Core/DiagonalCoeffs.h +++ b/Eigen/src/Core/DiagonalCoeffs.h @@ -68,21 +68,21 @@ template<typename MatrixType> class DiagonalCoeffs EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalCoeffs) - DiagonalCoeffs(const MatrixType& matrix) : m_matrix(matrix) {} + inline DiagonalCoeffs(const MatrixType& matrix) : m_matrix(matrix) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs) private: - int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); } - int _cols() const { return 1; } + inline int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); } + inline int _cols() const { return 1; } - Scalar& _coeffRef(int row, int) + inline Scalar& _coeffRef(int row, int) { return m_matrix.const_cast_derived().coeffRef(row, row); } - const Scalar _coeff(int row, int) const + inline const Scalar _coeff(int row, int) const { return m_matrix.coeff(row, row); } @@ -102,14 +102,14 @@ template<typename MatrixType> class DiagonalCoeffs * \sa class DiagonalCoeffs */ template<typename Derived> DiagonalCoeffs<Derived> -MatrixBase<Derived>::diagonal() +inline MatrixBase<Derived>::diagonal() { return DiagonalCoeffs<Derived>(derived()); } /** This is the const version of diagonal(). */ template<typename Derived> -const DiagonalCoeffs<Derived> +inline const DiagonalCoeffs<Derived> MatrixBase<Derived>::diagonal() const { return DiagonalCoeffs<Derived>(derived()); diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 972ef464e..030b1b732 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -62,7 +62,7 @@ class DiagonalMatrix : ei_no_assignment_operator, EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalMatrix) - DiagonalMatrix(const CoeffsVectorType& coeffs) : m_coeffs(coeffs) + inline DiagonalMatrix(const CoeffsVectorType& coeffs) : m_coeffs(coeffs) { ei_assert(CoeffsVectorType::IsVectorAtCompileTime && coeffs.size() > 0); @@ -70,10 +70,10 @@ class DiagonalMatrix : ei_no_assignment_operator, private: - int _rows() const { return m_coeffs.size(); } - int _cols() const { return m_coeffs.size(); } + inline int _rows() const { return m_coeffs.size(); } + inline int _cols() const { return m_coeffs.size(); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return row == col ? m_coeffs.coeff(row) : static_cast<Scalar>(0); } @@ -92,7 +92,7 @@ class DiagonalMatrix : ei_no_assignment_operator, * \sa class DiagonalMatrix, isDiagonal() **/ template<typename Derived> -const DiagonalMatrix<Derived> +inline const DiagonalMatrix<Derived> MatrixBase<Derived>::asDiagonal() const { return DiagonalMatrix<Derived>(derived()); diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index c1c607639..28a93e71d 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -28,7 +28,7 @@ template<int Index, int Size, typename Derived1, typename Derived2> struct ei_dot_unroller { - static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) + inline static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { ei_dot_unroller<Index-1, Size, Derived1, Derived2>::run(v1, v2, dot); dot += v1.coeff(Index) * ei_conj(v2.coeff(Index)); @@ -38,7 +38,7 @@ struct ei_dot_unroller template<int Size, typename Derived1, typename Derived2> struct ei_dot_unroller<0, Size, Derived1, Derived2> { - static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) + inline static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { dot = v1.coeff(0) * ei_conj(v2.coeff(0)); } @@ -47,14 +47,14 @@ struct ei_dot_unroller<0, Size, Derived1, Derived2> template<int Index, typename Derived1, typename Derived2> struct ei_dot_unroller<Index, Dynamic, Derived1, Derived2> { - static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} + inline static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} }; // prevent buggy user code from causing an infinite recursion template<int Index, typename Derived1, typename Derived2> struct ei_dot_unroller<Index, 0, Derived1, Derived2> { - static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} + inline static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} }; /** \returns the dot product of *this with other. @@ -108,7 +108,7 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const * \sa dot(), norm() */ template<typename Derived> -typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm2() const +inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm2() const { return ei_real(dot(*this)); } @@ -120,7 +120,7 @@ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived * \sa dot(), norm2() */ template<typename Derived> -typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const +inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const { return ei_sqrt(norm2()); } @@ -132,7 +132,7 @@ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived * \sa norm() */ template<typename Derived> -const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> MatrixBase<Derived>::normalized() const { return (*this) * (Scalar(1)/norm()); diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h index 5af460dac..8472081a0 100644 --- a/Eigen/src/Core/Functors.h +++ b/Eigen/src/Core/Functors.h @@ -33,9 +33,9 @@ * \sa class CwiseBinaryOp, MatrixBase::operator+, class PartialRedux, MatrixBase::sum() */ template<typename Scalar> struct ei_scalar_sum_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } + inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } template<typename PacketScalar> - PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const + inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const { return ei_padd(a,b); } }; template<typename Scalar> @@ -52,9 +52,9 @@ struct ei_functor_traits<ei_scalar_sum_op<Scalar> > { * \sa class CwiseBinaryOp, MatrixBase::cwiseProduct(), class PartialRedux, MatrixBase::redux() */ template<typename Scalar> struct ei_scalar_product_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; } + inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; } template<typename PacketScalar> - PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const + inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const { return ei_pmul(a,b); } }; template<typename Scalar> @@ -71,9 +71,9 @@ struct ei_functor_traits<ei_scalar_product_op<Scalar> > { * \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class PartialRedux, MatrixBase::minCoeff() */ template<typename Scalar> struct ei_scalar_min_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::min(a, b); } + inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::min(a, b); } template<typename PacketScalar> - PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const + inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const { return ei_pmin(a,b); } }; template<typename Scalar> @@ -90,9 +90,9 @@ struct ei_functor_traits<ei_scalar_min_op<Scalar> > { * \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class PartialRedux, MatrixBase::maxCoeff() */ template<typename Scalar> struct ei_scalar_max_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::max(a, b); } + inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::max(a, b); } template<typename PacketScalar> - PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const + inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const { return ei_pmax(a,b); } }; template<typename Scalar> @@ -112,9 +112,9 @@ struct ei_functor_traits<ei_scalar_max_op<Scalar> > { * \sa class CwiseBinaryOp, MatrixBase::operator- */ template<typename Scalar> struct ei_scalar_difference_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } + inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } template<typename PacketScalar> - PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const + inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const { return ei_psub(a,b); } }; template<typename Scalar> @@ -131,7 +131,7 @@ struct ei_functor_traits<ei_scalar_difference_op<Scalar> > { * \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient() */ template<typename Scalar> struct ei_scalar_quotient_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } + inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_quotient_op<Scalar> > @@ -146,7 +146,7 @@ struct ei_functor_traits<ei_scalar_quotient_op<Scalar> > * \sa class CwiseUnaryOp, MatrixBase::operator- */ template<typename Scalar> struct ei_scalar_opposite_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return -a; } + inline const Scalar operator() (const Scalar& a) const { return -a; } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_opposite_op<Scalar> > @@ -159,7 +159,7 @@ struct ei_functor_traits<ei_scalar_opposite_op<Scalar> > */ template<typename Scalar> struct ei_scalar_abs_op EIGEN_EMPTY_STRUCT { typedef typename NumTraits<Scalar>::Real result_type; - const result_type operator() (const Scalar& a) const { return ei_abs(a); } + inline const result_type operator() (const Scalar& a) const { return ei_abs(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_abs_op<Scalar> > @@ -172,7 +172,7 @@ struct ei_functor_traits<ei_scalar_abs_op<Scalar> > */ template<typename Scalar> struct ei_scalar_abs2_op EIGEN_EMPTY_STRUCT { typedef typename NumTraits<Scalar>::Real result_type; - const result_type operator() (const Scalar& a) const { return ei_abs2(a); } + inline const result_type operator() (const Scalar& a) const { return ei_abs2(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_abs2_op<Scalar> > @@ -184,7 +184,7 @@ struct ei_functor_traits<ei_scalar_abs2_op<Scalar> > * \sa class CwiseUnaryOp, MatrixBase::conjugate() */ template<typename Scalar> struct ei_scalar_conjugate_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return ei_conj(a); } + inline const Scalar operator() (const Scalar& a) const { return ei_conj(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> > @@ -198,7 +198,7 @@ struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> > template<typename Scalar, typename NewType> struct ei_scalar_cast_op EIGEN_EMPTY_STRUCT { typedef NewType result_type; - const NewType operator() (const Scalar& a) const { return static_cast<NewType>(a); } + inline const NewType operator() (const Scalar& a) const { return static_cast<NewType>(a); } }; template<typename Scalar, typename NewType> struct ei_functor_traits<ei_scalar_cast_op<Scalar,NewType> > @@ -215,16 +215,16 @@ template<typename Scalar, bool IsVectorizable = (int(ei_packet_traits<Scalar>::s template<typename Scalar> struct ei_scalar_multiple_op<Scalar,true> { typedef typename ei_packet_traits<Scalar>::type PacketScalar; - ei_scalar_multiple_op(const Scalar& other) : m_other(ei_pset1(other)) { } - Scalar operator() (const Scalar& a) const { return a * ei_pfirst(m_other); } - PacketScalar packetOp(const PacketScalar& a) const + inline ei_scalar_multiple_op(const Scalar& other) : m_other(ei_pset1(other)) { } + inline Scalar operator() (const Scalar& a) const { return a * ei_pfirst(m_other); } + inline const PacketScalar packetOp(const PacketScalar& a) const { return ei_pmul(a, m_other); } const PacketScalar m_other; }; template<typename Scalar> struct ei_scalar_multiple_op<Scalar,false> { - ei_scalar_multiple_op(const Scalar& other) : m_other(other) { } - Scalar operator() (const Scalar& a) const { return a * m_other; } + inline ei_scalar_multiple_op(const Scalar& other) : m_other(other) { } + inline Scalar operator() (const Scalar& a) const { return a * m_other; } const Scalar m_other; }; template<typename Scalar> @@ -233,8 +233,8 @@ struct ei_functor_traits<ei_scalar_multiple_op<Scalar> > template<typename Scalar, bool HasFloatingPoint> struct ei_scalar_quotient1_impl { - ei_scalar_quotient1_impl(const Scalar& other) : m_other(static_cast<Scalar>(1) / other) {} - Scalar operator() (const Scalar& a) const { return a * m_other; } + inline ei_scalar_quotient1_impl(const Scalar& other) : m_other(static_cast<Scalar>(1) / other) {} + inline Scalar operator() (const Scalar& a) const { return a * m_other; } const Scalar m_other; }; template<typename Scalar> @@ -243,8 +243,8 @@ struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,true> > template<typename Scalar> struct ei_scalar_quotient1_impl<Scalar,false> { - ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {} - Scalar operator() (const Scalar& a) const { return a / m_other; } + inline ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {} + inline Scalar operator() (const Scalar& a) const { return a / m_other; } const Scalar m_other; enum { Cost = 2 * NumTraits<Scalar>::MulCost }; }; @@ -262,7 +262,7 @@ struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,false> > */ template<typename Scalar> struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint > { - ei_scalar_quotient1_op(const Scalar& other) + inline ei_scalar_quotient1_op(const Scalar& other) : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint >(other) {} }; @@ -272,7 +272,7 @@ struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scala * \sa class CwiseUnaryOp, MatrixBase::cwiseSqrt() */ template<typename Scalar> struct ei_scalar_sqrt_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return ei_sqrt(a); } + inline const Scalar operator() (const Scalar& a) const { return ei_sqrt(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> > @@ -284,7 +284,7 @@ struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> > * \sa class CwiseUnaryOp, MatrixBase::cwiseExp() */ template<typename Scalar> struct ei_scalar_exp_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return ei_exp(a); } + inline const Scalar operator() (const Scalar& a) const { return ei_exp(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_exp_op<Scalar> > @@ -296,7 +296,7 @@ struct ei_functor_traits<ei_scalar_exp_op<Scalar> > * \sa class CwiseUnaryOp, MatrixBase::cwiseLog() */ template<typename Scalar> struct ei_scalar_log_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return ei_log(a); } + inline const Scalar operator() (const Scalar& a) const { return ei_log(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_log_op<Scalar> > @@ -308,7 +308,7 @@ struct ei_functor_traits<ei_scalar_log_op<Scalar> > * \sa class CwiseUnaryOp, MatrixBase::cwiseCos() */ template<typename Scalar> struct ei_scalar_cos_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return ei_cos(a); } + inline const Scalar operator() (const Scalar& a) const { return ei_cos(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_cos_op<Scalar> > @@ -320,7 +320,7 @@ struct ei_functor_traits<ei_scalar_cos_op<Scalar> > * \sa class CwiseUnaryOp, MatrixBase::cwiseSin() */ template<typename Scalar> struct ei_scalar_sin_op EIGEN_EMPTY_STRUCT { - const Scalar operator() (const Scalar& a) const { return ei_sin(a); } + inline const Scalar operator() (const Scalar& a) const { return ei_sin(a); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_sin_op<Scalar> > @@ -333,8 +333,8 @@ struct ei_functor_traits<ei_scalar_sin_op<Scalar> > */ template<typename Scalar> struct ei_scalar_pow_op { - ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} - Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); } + inline ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} + inline Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); } const Scalar m_exponent; }; template<typename Scalar> @@ -348,16 +348,16 @@ template<typename Scalar, bool IsVectorizable = (int(ei_packet_traits<Scalar>::s template<typename Scalar> struct ei_scalar_constant_op<Scalar,true> { typedef typename ei_packet_traits<Scalar>::type PacketScalar; - ei_scalar_constant_op(const Scalar& other) : m_other(ei_pset1(other)) { } - Scalar operator() (int, int) const { return ei_pfirst(m_other); } - PacketScalar packetOp() const + inline ei_scalar_constant_op(const Scalar& other) : m_other(ei_pset1(other)) { } + inline const Scalar operator() (int, int) const { return ei_pfirst(m_other); } + inline const PacketScalar packetOp() const { return m_other; } const PacketScalar m_other; }; template<typename Scalar> struct ei_scalar_constant_op<Scalar,false> { - ei_scalar_constant_op(const Scalar& other) : m_other(other) { } - Scalar operator() (int, int) const { return m_other; } + inline ei_scalar_constant_op(const Scalar& other) : m_other(other) { } + inline const Scalar operator() (int, int) const { return m_other; } const Scalar m_other; }; template<typename Scalar> @@ -366,8 +366,8 @@ struct ei_functor_traits<ei_scalar_constant_op<Scalar> > template<typename Scalar> struct ei_scalar_random_op EIGEN_EMPTY_STRUCT { - ei_scalar_random_op(void) {} - Scalar operator() (int, int) const { return ei_random<Scalar>(); } + inline ei_scalar_random_op(void) {} + inline const Scalar operator() (int, int) const { return ei_random<Scalar>(); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_random_op<Scalar> > @@ -375,8 +375,8 @@ struct ei_functor_traits<ei_scalar_random_op<Scalar> > template<typename Scalar> struct ei_scalar_identity_op EIGEN_EMPTY_STRUCT { - ei_scalar_identity_op(void) {} - Scalar operator() (int row, int col) const { return row==col ? Scalar(1) : Scalar(0); } + inline ei_scalar_identity_op(void) {} + inline const Scalar operator() (int row, int col) const { return row==col ? Scalar(1) : Scalar(0); } }; template<typename Scalar> struct ei_functor_traits<ei_scalar_identity_op<Scalar> > diff --git a/Eigen/src/Core/Lazy.h b/Eigen/src/Core/Lazy.h index d2f763680..ef02c9832 100644 --- a/Eigen/src/Core/Lazy.h +++ b/Eigen/src/Core/Lazy.h @@ -58,22 +58,22 @@ template<typename ExpressionType> class Lazy EIGEN_GENERIC_PUBLIC_INTERFACE(Lazy) - Lazy(const ExpressionType& matrix) : m_expression(matrix) {} + inline Lazy(const ExpressionType& matrix) : m_expression(matrix) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Lazy) private: - int _rows() const { return m_expression.rows(); } - int _cols() const { return m_expression.cols(); } + inline int _rows() const { return m_expression.rows(); } + inline int _cols() const { return m_expression.cols(); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_expression.coeff(row, col); } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline PacketScalar _packetCoeff(int row, int col) const { return m_expression.template packetCoeff<LoadMode>(row, col); } @@ -88,7 +88,7 @@ template<typename ExpressionType> class Lazy * Output: \verbinclude MatrixBase_lazy.out */ template<typename Derived> -const Lazy<Derived> +inline const Lazy<Derived> MatrixBase<Derived>::lazy() const { return Lazy<Derived>(derived()); diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index 1f9a0f244..a503043ac 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -61,10 +61,10 @@ template<typename MatrixType> class Map private: - int _rows() const { return m_rows; } - int _cols() const { return m_cols; } + inline int _rows() const { return m_rows; } + inline int _cols() const { return m_cols; } - const Scalar& _coeff(int row, int col) const + inline const Scalar& _coeff(int row, int col) const { if(Flags & RowMajorBit) return m_data[col + row * m_cols]; @@ -72,7 +72,7 @@ template<typename MatrixType> class Map return m_data[row + col * m_rows]; } - Scalar& _coeffRef(int row, int col) + inline Scalar& _coeffRef(int row, int col) { if(Flags & RowMajorBit) return const_cast<Scalar*>(m_data)[col + row * m_cols]; @@ -81,7 +81,7 @@ template<typename MatrixType> class Map } public: - Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols) + inline Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols) { ei_assert(rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) @@ -98,7 +98,7 @@ template<typename MatrixType> class Map /** This is the const version of map(Scalar*,int,int). */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > +inline const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data, int rows, int cols) { return Map<Matrix>(data, rows, cols); @@ -106,7 +106,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* dat /** This is the const version of map(Scalar*,int). */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > +inline const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data, int size) { ei_assert(_Cols == 1 || _Rows ==1); @@ -118,7 +118,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* dat /** This is the const version of map(Scalar*). */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > +inline const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data) { return Map<Matrix>(data, _Rows, _Cols); @@ -136,7 +136,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* dat * \sa map(const Scalar*, int, int), map(Scalar*, int), map(Scalar*), class Map */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > +inline Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int rows, int cols) { return Map<Matrix>(data, rows, cols); @@ -155,7 +155,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int * \sa map(const Scalar*, int), map(Scalar*, int, int), map(Scalar*), class Map */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > +inline Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int size) { ei_assert(_Cols == 1 || _Rows ==1); @@ -175,7 +175,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int * \sa map(const Scalar*), map(Scalar*, int), map(Scalar*, int, int), class Map */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > +inline Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data) { return Map<Matrix>(data, _Rows, _Cols); @@ -190,7 +190,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data) * \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int, int) */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> +inline Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> ::Matrix(const Scalar *data, int rows, int cols) : m_storage(rows*cols, rows, cols) { @@ -208,7 +208,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> * \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int) */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> +inline Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> ::Matrix(const Scalar *data, int size) : m_storage(size, RowsAtCompileTime == 1 ? 1 : size, ColsAtCompileTime == 1 ? 1 : size) { @@ -226,7 +226,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> * Matrix::map(const Scalar *) */ template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> -Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> +inline Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> ::Matrix(const Scalar *data) { *this = map(data); diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 016a9ef06..2fa4b16cf 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -97,10 +97,10 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage; - int _rows() const { return m_storage.rows(); } - int _cols() const { return m_storage.cols(); } + inline int _rows() const { return m_storage.rows(); } + inline int _cols() const { return m_storage.cols(); } - int _stride(void) const + inline int _stride(void) const { if(Flags & RowMajorBit) return m_storage.cols(); @@ -108,7 +108,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, return m_storage.rows(); } - const Scalar& _coeff(int row, int col) const + inline const Scalar& _coeff(int row, int col) const { if(Flags & RowMajorBit) return m_storage.data()[col + row * m_storage.cols()]; @@ -116,7 +116,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, return m_storage.data()[row + col * m_storage.rows()]; } - Scalar& _coeffRef(int row, int col) + inline Scalar& _coeffRef(int row, int col) { if(Flags & RowMajorBit) return m_storage.data()[col + row * m_storage.cols()]; @@ -125,7 +125,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline PacketScalar _packetCoeff(int row, int col) const { ei_internal_assert(Flags & VectorizableBit); if(Flags & RowMajorBit) @@ -141,7 +141,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, } template<int StoreMode> - void _writePacketCoeff(int row, int col, const PacketScalar& x) + inline void _writePacketCoeff(int row, int col, const PacketScalar& x) { ei_internal_assert(Flags & VectorizableBit); if(Flags & RowMajorBit) @@ -158,14 +158,14 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, public: /** \returns a const pointer to the data array of this matrix */ - const Scalar *data() const + inline const Scalar *data() const { return m_storage.data(); } /** \returns a pointer to the data array of this matrix */ - Scalar *data() + inline Scalar *data() { return m_storage.data(); } - void resize(int rows, int cols) + inline void resize(int rows, int cols) { ei_assert(rows > 0 && (MaxRowsAtCompileTime == Dynamic || MaxRowsAtCompileTime >= rows) @@ -185,7 +185,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, * row-vectors remain row-vectors and vectors remain vectors. */ template<typename OtherDerived> - Matrix& operator=(const MatrixBase<OtherDerived>& other) + inline Matrix& operator=(const MatrixBase<OtherDerived>& other) { if(RowsAtCompileTime == 1) { @@ -204,7 +204,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ - Matrix& operator=(const Matrix& other) + inline Matrix& operator=(const Matrix& other) { return operator=<Matrix>(other); } @@ -225,7 +225,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, * For dynamic-size matrices and vectors, this constructor is forbidden (guarded by * an assertion) because it would leave the matrix without an allocated data buffer. */ - explicit Matrix() + inline explicit Matrix() { ei_assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0); } @@ -236,7 +236,8 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, * it is redundant to pass the dimension here, so it makes more sense to use the default * constructor Matrix() instead. */ - explicit Matrix(int dim) : m_storage(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + inline explicit Matrix(int dim) + : m_storage(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) { ei_assert(dim > 0); ei_assert((RowsAtCompileTime == 1 @@ -255,7 +256,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, * it is redundant to pass these parameters, so one should use the default constructor * Matrix() instead. */ - Matrix(int x, int y) : m_storage(x*y, x, y) + inline Matrix(int x, int y) : m_storage(x*y, x, y) { if((RowsAtCompileTime == 1 && ColsAtCompileTime == 2) || (RowsAtCompileTime == 2 && ColsAtCompileTime == 1)) @@ -270,7 +271,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, } } /** constructs an initialized 2D vector with given coefficients */ - Matrix(const float& x, const float& y) + inline Matrix(const float& x, const float& y) { ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 2) || (RowsAtCompileTime == 2 && ColsAtCompileTime == 1)); @@ -278,7 +279,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, m_storage.data()[1] = y; } /** constructs an initialized 2D vector with given coefficients */ - Matrix(const double& x, const double& y) + inline Matrix(const double& x, const double& y) { ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 2) || (RowsAtCompileTime == 2 && ColsAtCompileTime == 1)); @@ -286,7 +287,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, m_storage.data()[1] = y; } /** constructs an initialized 3D vector with given coefficients */ - Matrix(const Scalar& x, const Scalar& y, const Scalar& z) + inline Matrix(const Scalar& x, const Scalar& y, const Scalar& z) { ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 3) || (RowsAtCompileTime == 3 && ColsAtCompileTime == 1)); @@ -295,7 +296,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, m_storage.data()[2] = z; } /** constructs an initialized 4D vector with given coefficients */ - Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + inline Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) { ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 4) || (RowsAtCompileTime == 4 && ColsAtCompileTime == 1)); @@ -310,19 +311,19 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, /** Constructor copying the value of the expression \a other */ template<typename OtherDerived> - Matrix(const MatrixBase<OtherDerived>& other) + inline Matrix(const MatrixBase<OtherDerived>& other) : m_storage(other.rows() * other.cols(), other.rows(), other.cols()) { Base::lazyAssign(other.derived()); } /** Copy constructor */ - Matrix(const Matrix& other) + inline Matrix(const Matrix& other) : m_storage(other.rows() * other.cols(), other.rows(), other.cols()) { Base::lazyAssign(other); } /** Destructor */ - ~Matrix() {} + inline ~Matrix() {} }; #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 5baa42261..9078e5677 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -151,17 +151,17 @@ template<typename Derived> class MatrixBase /// \name Run-time traits //@{ /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ - int rows() const { return derived()._rows(); } + inline int rows() const { return derived()._rows(); } /** \returns the number of columns. \sa row(), ColsAtCompileTime*/ - int cols() const { return derived()._cols(); } + inline int cols() const { return derived()._cols(); } /** \returns the number of coefficients, which is \a rows()*cols(). * \sa rows(), cols(), SizeAtCompileTime. */ - int size() const { return rows() * cols(); } + inline int size() const { return rows() * cols(); } /** \returns true if either the number of rows or the number of columns is equal to 1. * In other words, this function returns * \code rows()==1 || cols()==1 \endcode * \sa rows(), cols(), IsVectorAtCompileTime. */ - bool isVector() const { return rows()==1 || cols()==1; } + inline bool isVector() const { return rows()==1 || cols()==1; } //@} /// \name Copying and initialization @@ -178,7 +178,7 @@ template<typename Derived> class MatrixBase /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ - Derived& operator=(const MatrixBase& other) + inline Derived& operator=(const MatrixBase& other) { return this->operator=<Derived>(other); } @@ -208,9 +208,9 @@ template<typename Derived> class MatrixBase Scalar& operator[](int index); template<int LoadMode> - PacketScalar packetCoeff(int row, int col) const { return derived().template _packetCoeff<LoadMode>(row,col); } + PacketScalar packetCoeff(int row, int col) const; template<int StoreMode> - void writePacketCoeff(int row, int col, const PacketScalar& x) { return derived().template _writePacketCoeff<StoreMode>(row,col,x); } + void writePacketCoeff(int row, int col, const PacketScalar& x); const Scalar x() const; const Scalar y() const; @@ -244,10 +244,12 @@ template<typename Derived> class MatrixBase Derived& operator*=(const Scalar& other); Derived& operator/=(const Scalar& other); - const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> operator*(const Scalar& scalar) const; - const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived> operator/(const Scalar& scalar) const; + const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> + operator*(const Scalar& scalar) const; + const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived> + operator/(const Scalar& scalar) const; - friend const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> + inline friend const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> operator*(const Scalar& scalar, const MatrixBase& matrix) { return matrix*scalar; } //@} @@ -396,11 +398,11 @@ template<typename Derived> class MatrixBase bool isOrtho(RealScalar prec = precision<Scalar>()) const; template<typename OtherDerived> - bool operator==(const MatrixBase<OtherDerived>& other) const + inline bool operator==(const MatrixBase<OtherDerived>& other) const { return derived().cwiseEqualTo(other.derived()).all(); } template<typename OtherDerived> - bool operator!=(const MatrixBase<OtherDerived>& other) const + inline bool operator!=(const MatrixBase<OtherDerived>& other) const { return derived().cwiseNotEqualTo(other.derived()).all(); } //@} @@ -409,7 +411,7 @@ template<typename Derived> class MatrixBase template<typename NewType> const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const; - EIGEN_INLINE const typename ei_eval<Derived>::type eval() const + EIGEN_ALWAYS_INLINE const typename ei_eval<Derived>::type eval() const { return typename ei_eval<Derived>::type(derived()); } @@ -522,9 +524,9 @@ template<typename Derived> class MatrixBase /// \name Casting to the derived type //@{ - const Derived& derived() const { return *static_cast<const Derived*>(this); } - Derived& derived() { return *static_cast<Derived*>(this); } - Derived& const_cast_derived() const + inline const Derived& derived() const { return *static_cast<const Derived*>(this); } + inline Derived& derived() { return *static_cast<Derived*>(this); } + inline Derived& const_cast_derived() const { return *static_cast<Derived*>(const_cast<MatrixBase*>(this)); } //@} @@ -562,13 +564,6 @@ template<typename Derived> class MatrixBase const QR<typename ei_eval<Derived>::type> qr() const; //@} - private: - - template<int LoadMode> - PacketScalar _packetCoeff(int , int) const { ei_internal_assert(false && "_packetCoeff not defined"); } - template<int StoreMode> - void _writePacketCoeff(int , int, const PacketScalar&) { ei_internal_assert(false && "_packetCoeff not defined"); } - }; #endif // EIGEN_MATRIXBASE_H diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/MatrixStorage.h index 6f88a31d6..94336f1a8 100644 --- a/Eigen/src/Core/MatrixStorage.h +++ b/Eigen/src/Core/MatrixStorage.h @@ -50,7 +50,7 @@ template <typename T, int Size> struct ei_aligned_array<T,Size,false> }; template<typename T> -T* ei_aligned_malloc(size_t size) +inline T* ei_aligned_malloc(size_t size) { #ifdef EIGEN_VECTORIZE if (ei_packet_traits<T>::size>1) @@ -67,7 +67,7 @@ T* ei_aligned_malloc(size_t size) } template<typename T> -void ei_aligned_free(T* ptr) +inline void ei_aligned_free(T* ptr) { #ifdef EIGEN_VECTORIZE if (ei_packet_traits<T>::size>1) @@ -82,13 +82,13 @@ template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage { ei_aligned_array<T,Size,((Size*sizeof(T))%16)==0> m_data; public: - 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) {} - const T *data() const { return m_data.array; } - T *data() { return m_data.array; } + inline ei_matrix_storage() {} + inline ei_matrix_storage(int,int,int) {} + inline static int rows(void) {return _Rows;} + inline static int cols(void) {return _Cols;} + inline void resize(int,int,int) {} + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage @@ -98,17 +98,17 @@ template<typename T, int Size> class ei_matrix_storage<T, Size, Dynamic, Dynamic int m_rows; int m_cols; public: - 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) + inline ei_matrix_storage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {} + inline ~ei_matrix_storage() {} + inline int rows(void) const {return m_rows;} + inline int cols(void) const {return m_cols;} + inline void resize(int, int rows, int cols) { m_rows = rows; m_cols = cols; } - const T *data() const { return m_data; } - T *data() { return m_data; } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } }; // dynamic-size matrix with fixed-size storage and fixed width @@ -117,16 +117,16 @@ template<typename T, int Size, int _Cols> class ei_matrix_storage<T, Size, Dynam T m_data[Size]; int m_rows; public: - 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) + inline ei_matrix_storage(int, int rows, int) : m_rows(rows) {} + inline ~ei_matrix_storage() {} + inline int rows(void) const {return m_rows;} + inline int cols(void) const {return _Cols;} + inline void resize(int size, int rows, int) { m_rows = rows; } - const T *data() const { return m_data; } - T *data() { return m_data; } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } }; // dynamic-size matrix with fixed-size storage and fixed height @@ -135,16 +135,16 @@ template<typename T, int Size, int _Rows> class ei_matrix_storage<T, Size, _Rows T m_data[Size]; int m_cols; public: - 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) + inline ei_matrix_storage(int, int, int cols) : m_cols(cols) {} + inline ~ei_matrix_storage() {} + inline int rows(void) const {return _Rows;} + inline int cols(void) const {return m_cols;} + inline void resize(int size, int, int cols) { m_cols = cols; } - const T *data() const { return m_data; } - T *data() { return m_data; } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } }; // purely dynamic matrix. @@ -154,11 +154,11 @@ template<typename T> class ei_matrix_storage<T, Dynamic, Dynamic, Dynamic> int m_rows; int m_cols; public: - ei_matrix_storage(int size, int rows, int cols) + inline ei_matrix_storage(int size, int rows, int cols) : m_data(ei_aligned_malloc<T>(size)), m_rows(rows), m_cols(cols) {} - ~ei_matrix_storage() { delete[] m_data; } - int rows(void) const {return m_rows;} - int cols(void) const {return m_cols;} + inline ~ei_matrix_storage() { delete[] m_data; } + inline int rows(void) const {return m_rows;} + inline int cols(void) const {return m_cols;} void resize(int size, int rows, int cols) { if(size != m_rows*m_cols) @@ -169,8 +169,8 @@ template<typename T> class ei_matrix_storage<T, Dynamic, Dynamic, Dynamic> m_rows = rows; m_cols = cols; } - const T *data() const { return m_data; } - T *data() { return m_data; } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } }; // matrix with dynamic width and fixed height (so that matrix has dynamic size). @@ -179,10 +179,10 @@ template<typename T, int _Rows> class ei_matrix_storage<T, Dynamic, _Rows, Dynam T *m_data; int m_cols; public: - ei_matrix_storage(int size, int, int cols) : m_data(ei_aligned_malloc<T>(size)), m_cols(cols) {} - ~ei_matrix_storage() { delete[] m_data; } - static int rows(void) {return _Rows;} - int cols(void) const {return m_cols;} + inline ei_matrix_storage(int size, int, int cols) : m_data(ei_aligned_malloc<T>(size)), m_cols(cols) {} + inline ~ei_matrix_storage() { delete[] m_data; } + inline static int rows(void) {return _Rows;} + inline int cols(void) const {return m_cols;} void resize(int size, int, int cols) { if(size != _Rows*m_cols) @@ -192,8 +192,8 @@ template<typename T, int _Rows> class ei_matrix_storage<T, Dynamic, _Rows, Dynam } m_cols = cols; } - const T *data() const { return m_data; } - T *data() { return m_data; } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } }; // matrix with dynamic height and fixed width (so that matrix has dynamic size). @@ -202,10 +202,10 @@ template<typename T, int _Cols> class ei_matrix_storage<T, Dynamic, Dynamic, _Co T *m_data; int m_rows; public: - ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_malloc<T>(size)), m_rows(rows) {} - ~ei_matrix_storage() { delete[] m_data; } - int rows(void) const {return m_rows;} - static int cols(void) {return _Cols;} + inline ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_malloc<T>(size)), m_rows(rows) {} + inline ~ei_matrix_storage() { delete[] m_data; } + inline int rows(void) const {return m_rows;} + inline static int cols(void) {return _Cols;} void resize(int size, int rows, int) { if(size != m_rows*_Cols) @@ -215,8 +215,8 @@ template<typename T, int _Cols> class ei_matrix_storage<T, Dynamic, Dynamic, _Co } m_rows = rows; } - const T *data() const { return m_data; } - T *data() { return m_data; } + inline const T *data() const { return m_data; } + inline T *data() { return m_data; } }; #endif // EIGEN_MATRIX_H diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h index ef61a7f60..4a0edc3a3 100644 --- a/Eigen/src/Core/Minor.h +++ b/Eigen/src/Core/Minor.h @@ -64,8 +64,8 @@ template<typename MatrixType> class Minor EIGEN_GENERIC_PUBLIC_INTERFACE(Minor) - Minor(const MatrixType& matrix, - int row, int col) + inline Minor(const MatrixType& matrix, + int row, int col) : m_matrix(matrix), m_row(row), m_col(col) { ei_assert(row >= 0 && row < matrix.rows() @@ -76,15 +76,15 @@ template<typename MatrixType> class Minor private: - int _rows() const { return m_matrix.rows() - 1; } - int _cols() const { return m_matrix.cols() - 1; } + inline int _rows() const { return m_matrix.rows() - 1; } + inline int _cols() const { return m_matrix.cols() - 1; } - Scalar& _coeffRef(int row, int col) + inline Scalar& _coeffRef(int row, int col) { return m_matrix.const_cast_derived().coeffRef(row + (row >= m_row), col + (col >= m_col)); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_matrix.coeff(row + (row >= m_row), col + (col >= m_col)); } @@ -104,7 +104,7 @@ template<typename MatrixType> class Minor * \sa class Minor */ template<typename Derived> -Minor<Derived> +inline Minor<Derived> MatrixBase<Derived>::minor(int row, int col) { return Minor<Derived>(derived(), row, col); @@ -112,7 +112,7 @@ MatrixBase<Derived>::minor(int row, int col) /** This is the const version of minor(). */ template<typename Derived> -const Minor<Derived> +inline const Minor<Derived> MatrixBase<Derived>::minor(int row, int col) const { return Minor<Derived>(derived(), row, col); diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index dbd8b6cdd..414843651 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -29,8 +29,8 @@ template<int Index, int Size, typename Lhs, typename Rhs> struct ei_product_unroller { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, - typename Lhs::Scalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, + typename Lhs::Scalar &res) { ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res); res += lhs.coeff(row, Index) * rhs.coeff(Index, col); @@ -40,8 +40,8 @@ struct ei_product_unroller template<int Size, typename Lhs, typename 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) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, + typename Lhs::Scalar &res) { res = lhs.coeff(row, 0) * rhs.coeff(0, col); } @@ -50,14 +50,14 @@ struct ei_product_unroller<0, Size, Lhs, Rhs> template<int Index, typename Lhs, typename Rhs> struct ei_product_unroller<Index, Dynamic, Lhs, Rhs> { - static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; // prevent buggy user code from causing an infinite recursion template<int Index, typename Lhs, typename Rhs> struct ei_product_unroller<Index, 0, Lhs, Rhs> { - static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; template<typename Lhs, typename Rhs> @@ -72,7 +72,7 @@ struct ei_packet_product_unroller; template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { ei_packet_product_unroller<true, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packetCoeff<Aligned>(Index, col), res); @@ -82,7 +82,7 @@ struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar> template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { ei_packet_product_unroller<false, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); res = ei_pmadd(lhs.template packetCoeff<Aligned>(row, Index), ei_pset1(rhs.coeff(Index, col)), res); @@ -92,7 +92,7 @@ struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packetCoeff<Aligned>(0, col)); } @@ -101,7 +101,7 @@ struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { res = ei_pmul(lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(rhs.coeff(0, col))); } @@ -110,13 +110,13 @@ struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar> template<bool RowMajor, int Index, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<RowMajor, Index, Dynamic, Lhs, Rhs, PacketScalar> { - static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} }; template<int Index, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<false, Index, Dynamic, Lhs, Rhs, PacketScalar> { - static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} }; template<typename Lhs, typename Rhs, typename PacketScalar> @@ -207,7 +207,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm typedef typename ei_traits<Product>::_LhsNested _LhsNested; typedef typename ei_traits<Product>::_RhsNested _RhsNested; - Product(const Lhs& lhs, const Rhs& rhs) + inline Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) { ei_assert(lhs.cols() == rhs.rows()); @@ -223,8 +223,8 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm private: - int _rows() const { return m_lhs.rows(); } - int _cols() const { return m_rhs.cols(); } + inline int _rows() const { return m_lhs.rows(); } + inline int _cols() const { return m_rhs.cols(); } const Scalar _coeff(int row, int col) const { @@ -247,7 +247,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + const PacketScalar _packetCoeff(int row, int col) const { if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT) { @@ -263,7 +263,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm return ProductPacketCoeffImpl<Product,Flags&RowMajorBit>::execute(*this, row, col); } - PacketScalar _packetCoeffRowMajor(int row, int col) const + const PacketScalar _packetCoeffRowMajor(int row, int col) const { PacketScalar res; res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packetCoeff<Aligned>(0, col)); @@ -272,7 +272,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm return res; } - PacketScalar _packetCoeffColumnMajor(int row, int col) const + const PacketScalar _packetCoeffColumnMajor(int row, int col) const { PacketScalar res; res = ei_pmul(m_lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(m_rhs.coeff(0, col))); @@ -304,7 +304,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm */ template<typename Derived> template<typename OtherDerived> -const Product<Derived,OtherDerived> +inline const Product<Derived,OtherDerived> MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const { return Product<Derived,OtherDerived>(derived(), other.derived()); @@ -316,7 +316,7 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -Derived & +inline Derived & MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) { return *this = *this * other; @@ -324,7 +324,7 @@ MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) template<typename Derived> template<typename Lhs, typename Rhs> -Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product) +inline Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product) { product.template _cacheOptimalEval<Derived, Aligned>(derived(), #ifdef EIGEN_VECTORIZE diff --git a/Eigen/src/Core/ProductWIP.h b/Eigen/src/Core/ProductWIP.h index 0a7ef43e9..fae9e4ac8 100644 --- a/Eigen/src/Core/ProductWIP.h +++ b/Eigen/src/Core/ProductWIP.h @@ -31,8 +31,8 @@ template<int Index, int Size, typename Lhs, typename Rhs> struct ei_product_unroller { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, - typename Lhs::Scalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, + typename Lhs::Scalar &res) { ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res); res += lhs.coeff(row, Index) * rhs.coeff(Index, col); @@ -42,7 +42,7 @@ struct ei_product_unroller template<int Size, typename Lhs, typename Rhs> struct ei_product_unroller<0, Size, Lhs, Rhs> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res) { res = lhs.coeff(row, 0) * rhs.coeff(0, col); @@ -52,14 +52,14 @@ struct ei_product_unroller<0, Size, Lhs, Rhs> template<int Index, typename Lhs, typename Rhs> struct ei_product_unroller<Index, Dynamic, Lhs, Rhs> { - static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; // prevent buggy user code from causing an infinite recursion template<int Index, typename Lhs, typename Rhs> struct ei_product_unroller<Index, 0, Lhs, Rhs> { - static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; template<bool RowMajor, int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> @@ -68,7 +68,7 @@ struct ei_packet_product_unroller; template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { ei_packet_product_unroller<true, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packetCoeff<Aligned>(Index, col), res); @@ -78,7 +78,7 @@ struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar> template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { ei_packet_product_unroller<false, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); res = ei_pmadd(lhs.template packetCoeff<Aligned>(row, Index), ei_pset1(rhs.coeff(Index, col)), res); @@ -88,7 +88,7 @@ struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packetCoeff<Aligned>(0, col)); } @@ -97,7 +97,7 @@ struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar> { - static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) + inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) { res = ei_pmul(lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(rhs.coeff(0, col))); } @@ -106,13 +106,13 @@ struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar> template<bool RowMajor, int Index, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<RowMajor, Index, Dynamic, Lhs, Rhs, PacketScalar> { - static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} }; template<int Index, typename Lhs, typename Rhs, typename PacketScalar> struct ei_packet_product_unroller<false, Index, Dynamic, Lhs, Rhs, PacketScalar> { - static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} + inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} }; template<typename Product, bool RowMajor = true> struct ProductPacketCoeffImpl { @@ -260,7 +260,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm PacketSize = ei_packet_traits<Scalar>::size }; - Product(const Lhs& lhs, const Rhs& rhs) + inline Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) { ei_assert(lhs.cols() == rhs.rows()); @@ -272,8 +272,8 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm private: - int _rows() const { return m_lhs.rows(); } - int _cols() const { return m_rhs.cols(); } + inline int _rows() const { return m_lhs.rows(); } + inline int _cols() const { return m_rhs.cols(); } const Scalar _coeff(int row, int col) const { @@ -296,7 +296,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + const PacketScalar _packetCoeff(int row, int col) const { if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT) { @@ -312,7 +312,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm return ProductPacketCoeffImpl<Product,Flags&RowMajorBit>::execute(*this, row, col); } - PacketScalar _packetCoeffRowMajor(int row, int col) const + const PacketScalar _packetCoeffRowMajor(int row, int col) const { PacketScalar res; res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packetCoeff<Aligned>(0, col)); @@ -321,7 +321,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm return res; } - PacketScalar _packetCoeffColumnMajor(int row, int col) const + const PacketScalar _packetCoeffColumnMajor(int row, int col) const { PacketScalar res; res = ei_pmul(m_lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(m_rhs.coeff(0, col))); @@ -348,7 +348,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm */ template<typename Derived> template<typename OtherDerived> -const Product<Derived,OtherDerived> +inline const Product<Derived,OtherDerived> MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const { return Product<Derived,OtherDerived>(derived(), other.derived()); @@ -360,7 +360,7 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const */ template<typename Derived> template<typename OtherDerived> -Derived & +inline Derived & MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) { return *this = *this * other; @@ -368,7 +368,7 @@ MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) template<typename Derived> template<typename Lhs, typename Rhs> -Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product) +inline Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product) { product._cacheFriendlyEval(derived()); return derived(); @@ -376,7 +376,7 @@ Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProd template<typename Lhs, typename Rhs, int EvalMode> template<typename DestDerived> -void Product<Lhs,Rhs,EvalMode>::_cacheFriendlyEval(DestDerived& res) const +inline void Product<Lhs,Rhs,EvalMode>::_cacheFriendlyEval(DestDerived& res) const { #ifndef EIGEN_WIP_PRODUCT_DIRTY res.setZero(); diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h index cb8f4d525..5b14f5b27 100644 --- a/Eigen/src/Core/Redux.h +++ b/Eigen/src/Core/Redux.h @@ -203,7 +203,7 @@ MatrixBase<Derived>::redux(const BinaryOp& func) const */ template<typename Derived> typename ei_traits<Derived>::Scalar -MatrixBase<Derived>::sum() const +inline MatrixBase<Derived>::sum() const { return this->redux(Eigen::ei_scalar_sum_op<Scalar>()); } @@ -216,7 +216,7 @@ MatrixBase<Derived>::sum() const */ template<typename Derived> typename ei_traits<Derived>::Scalar -MatrixBase<Derived>::trace() const +inline MatrixBase<Derived>::trace() const { return diagonal().sum(); } @@ -225,7 +225,7 @@ MatrixBase<Derived>::trace() const */ template<typename Derived> typename ei_traits<Derived>::Scalar -MatrixBase<Derived>::minCoeff() const +inline MatrixBase<Derived>::minCoeff() const { return this->redux(Eigen::ei_scalar_min_op<Scalar>()); } @@ -234,7 +234,7 @@ MatrixBase<Derived>::minCoeff() const */ template<typename Derived> typename ei_traits<Derived>::Scalar -MatrixBase<Derived>::maxCoeff() const +inline MatrixBase<Derived>::maxCoeff() const { return this->redux(Eigen::ei_scalar_max_op<Scalar>()); } @@ -249,7 +249,7 @@ struct ei_all_unroller row = (UnrollCount-1) % Derived::RowsAtCompileTime }; - static bool run(const Derived &mat) + inline static bool run(const Derived &mat) { return ei_all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col); } @@ -258,13 +258,13 @@ struct ei_all_unroller template<typename Derived> struct ei_all_unroller<Derived, 1> { - static bool run(const Derived &mat) { return mat.coeff(0, 0); } + inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } }; template<typename Derived> struct ei_all_unroller<Derived, Dynamic> { - static bool run(const Derived &) { return false; } + inline static bool run(const Derived &) { return false; } }; template<typename Derived, int UnrollCount> @@ -275,7 +275,7 @@ struct ei_any_unroller row = (UnrollCount-1) % Derived::RowsAtCompileTime }; - static bool run(const Derived &mat) + inline static bool run(const Derived &mat) { return ei_any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col); } @@ -284,13 +284,13 @@ struct ei_any_unroller template<typename Derived> struct ei_any_unroller<Derived, 1> { - static bool run(const Derived &mat) { return mat.coeff(0, 0); } + inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } }; template<typename Derived> struct ei_any_unroller<Derived, Dynamic> { - static bool run(const Derived &) { return false; } + inline static bool run(const Derived &) { return false; } }; /** \returns true if all coefficients are true diff --git a/Eigen/src/Core/Temporary.h b/Eigen/src/Core/Temporary.h index 854bb4698..ed62ea786 100644 --- a/Eigen/src/Core/Temporary.h +++ b/Eigen/src/Core/Temporary.h @@ -59,20 +59,20 @@ template<typename ExpressionType> class Temporary EIGEN_GENERIC_PUBLIC_INTERFACE(Temporary) - Temporary(const ExpressionType& matrix) : m_expression(matrix) {} + inline Temporary(const ExpressionType& matrix) : m_expression(matrix) {} private: - int _rows() const { return m_expression.rows(); } - int _cols() const { return m_expression.cols(); } + inline int _rows() const { return m_expression.rows(); } + inline int _cols() const { return m_expression.cols(); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_expression.coeff(row, col); } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline const PacketScalar _packetCoeff(int row, int col) const { return m_expression.template packetCoeff<LoadMode>(row, col); } @@ -84,7 +84,7 @@ template<typename ExpressionType> class Temporary /** \returns an expression of the temporary version of *this. */ template<typename Derived> -const Temporary<Derived> +inline const Temporary<Derived> MatrixBase<Derived>::temporary() const { return Temporary<Derived>(derived()); diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index d98d06597..e7f37bbae 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -60,35 +60,35 @@ template<typename MatrixType> class Transpose EIGEN_GENERIC_PUBLIC_INTERFACE(Transpose) - Transpose(const MatrixType& matrix) : m_matrix(matrix) {} + inline Transpose(const MatrixType& matrix) : m_matrix(matrix) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) private: - int _rows() const { return m_matrix.cols(); } - int _cols() const { return m_matrix.rows(); } + inline int _rows() const { return m_matrix.cols(); } + inline int _cols() const { return m_matrix.rows(); } - int _stride(void) const { return m_matrix.stride(); } + inline int _stride(void) const { return m_matrix.stride(); } - Scalar& _coeffRef(int row, int col) + inline Scalar& _coeffRef(int row, int col) { return m_matrix.const_cast_derived().coeffRef(col, row); } - const Scalar _coeff(int row, int col) const + inline const Scalar _coeff(int row, int col) const { return m_matrix.coeff(col, row); } template<int LoadMode> - PacketScalar _packetCoeff(int row, int col) const + inline const PacketScalar _packetCoeff(int row, int col) const { return m_matrix.template packetCoeff<LoadMode>(col, row); } template<int LoadMode> - void _writePacketCoeff(int row, int col, const PacketScalar& x) + inline void _writePacketCoeff(int row, int col, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacketCoeff<LoadMode>(col, row, x); } @@ -104,7 +104,7 @@ template<typename MatrixType> class Transpose * * \sa adjoint(), class DiagonalCoeffs */ template<typename Derived> -Transpose<Derived> +inline Transpose<Derived> MatrixBase<Derived>::transpose() { return Transpose<Derived>(derived()); @@ -112,7 +112,7 @@ MatrixBase<Derived>::transpose() /** This is the const version of transpose(). \sa adjoint() */ template<typename Derived> -const Transpose<Derived> +inline const Transpose<Derived> MatrixBase<Derived>::transpose() const { return Transpose<Derived>(derived()); @@ -125,7 +125,9 @@ MatrixBase<Derived>::transpose() const * * \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */ template<typename Derived> -const Transpose<Temporary<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived > > > +inline const Transpose<Temporary< + CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived > + > > MatrixBase<Derived>::adjoint() const { return conjugate().temporary().transpose(); diff --git a/Eigen/src/Core/Triangular.h b/Eigen/src/Core/Triangular.h index 8a17a3fee..ff2dcbb37 100755 --- a/Eigen/src/Core/Triangular.h +++ b/Eigen/src/Core/Triangular.h @@ -79,7 +79,7 @@ template<int Mode, typename MatrixType> class Triangular EIGEN_GENERIC_PUBLIC_INTERFACE(Triangular) - Triangular(const MatrixType& matrix) + inline Triangular(const MatrixType& matrix) : m_matrix(matrix) { assert(!( (Flags&UnitDiagBit) && (Flags&NullDiagBit))); @@ -89,15 +89,15 @@ template<int Mode, typename MatrixType> class Triangular EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Triangular) /** Overloaded to keep a Triangular expression */ - Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > > transpose() + inline Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > > transpose() { - return Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary())); + return Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary())); } /** Overloaded to keep a Triangular expression */ - const Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > > transpose() const + inline const Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > > transpose() const { - return Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary())); + return Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary())); } /** \returns the product of the inverse of *this with \a other. @@ -154,16 +154,16 @@ template<int Mode, typename MatrixType> class Triangular private: - int _rows() const { return m_matrix.rows(); } - int _cols() const { return m_matrix.cols(); } + inline int _rows() const { return m_matrix.rows(); } + inline int _cols() const { return m_matrix.cols(); } - Scalar& _coeffRef(int row, int col) + inline Scalar& _coeffRef(int row, int col) { ei_assert( ((! (Flags & Lower)) && row<=col) || (Flags & Lower && col<=row)); return m_matrix.const_cast_derived().coeffRef(row, col); } - Scalar _coeff(int row, int col) const + inline Scalar _coeff(int row, int col) const { if ((Flags & Lower) ? col>row : row>col) return 0; @@ -185,14 +185,14 @@ template<int Mode, typename MatrixType> class Triangular * \sa isUpper(), upperWithNullDiagBit(), upperWithNullDiagBit(), lower() */ template<typename Derived> -Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) +inline Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) { return Triangular<Upper,Derived>(derived()); } /** This is the const version of upper(). */ template<typename Derived> -const Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) const +inline const Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) const { return Triangular<Upper,Derived>(derived()); } @@ -202,14 +202,14 @@ const Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) const * \sa isLower(), lowerWithUnitDiag(), lowerWithNullDiag(), upper() */ template<typename Derived> -Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) +inline Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) { return Triangular<Lower,Derived>(derived()); } /** This is the const version of lower().*/ template<typename Derived> -const Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) const +inline const Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) const { return Triangular<Lower,Derived>(derived()); } @@ -219,7 +219,7 @@ const Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) const * \sa upper(), lowerWithUnitDiagBit() */ template<typename Derived> -const Triangular<Upper|UnitDiagBit, Derived> MatrixBase<Derived>::upperWithUnitDiag(void) const +inline const Triangular<Upper|UnitDiagBit, Derived> MatrixBase<Derived>::upperWithUnitDiag(void) const { return Triangular<Upper|UnitDiagBit, Derived>(derived()); } @@ -230,7 +230,7 @@ const Triangular<Upper|UnitDiagBit, Derived> MatrixBase<Derived>::upperWithUnitD * \sa upper(), lowerWithNullDiag() */ template<typename Derived> -const Triangular<Upper|NullDiagBit, Derived> MatrixBase<Derived>::upperWithNullDiag(void) const +inline const Triangular<Upper|NullDiagBit, Derived> MatrixBase<Derived>::upperWithNullDiag(void) const { return Triangular<Upper|NullDiagBit, Derived>(derived()); } @@ -240,7 +240,7 @@ const Triangular<Upper|NullDiagBit, Derived> MatrixBase<Derived>::upperWithNullD * \sa lower(), upperWithUnitDiag() */ template<typename Derived> -const Triangular<Lower|UnitDiagBit, Derived> MatrixBase<Derived>::lowerWithUnitDiag(void) const +inline const Triangular<Lower|UnitDiagBit, Derived> MatrixBase<Derived>::lowerWithUnitDiag(void) const { return Triangular<Lower|UnitDiagBit, Derived>(derived()); } @@ -251,7 +251,7 @@ const Triangular<Lower|UnitDiagBit, Derived> MatrixBase<Derived>::lowerWithUnitD * \sa lower(), upperWithNullDiag() */ template<typename Derived> -const Triangular<Lower|NullDiagBit, Derived> MatrixBase<Derived>::lowerWithNullDiag(void) const +inline const Triangular<Lower|NullDiagBit, Derived> MatrixBase<Derived>::lowerWithNullDiag(void) const { return Triangular<Lower|NullDiagBit, Derived>(derived()); } @@ -300,5 +300,4 @@ bool MatrixBase<Derived>::isLower(RealScalar prec) const return true; } - #endif // EIGEN_TRIANGULAR_H diff --git a/Eigen/src/Core/TriangularAssign.h b/Eigen/src/Core/TriangularAssign.h index c52085ef1..ec208f2ad 100644 --- a/Eigen/src/Core/TriangularAssign.h +++ b/Eigen/src/Core/TriangularAssign.h @@ -33,7 +33,7 @@ struct ei_triangular_assign_unroller row = (UnrollCount-1) % Derived1::RowsAtCompileTime }; - static void run(Derived1 &dst, const Derived2 &src) + inline static void run(Derived1 &dst, const Derived2 &src) { ei_triangular_assign_unroller<Derived1, Derived2, (Mode & Lower) ? @@ -47,7 +47,7 @@ struct ei_triangular_assign_unroller template<typename Derived1, typename Derived2, int Mode> struct ei_triangular_assign_unroller<Derived1, Derived2, 1, Mode> { - static void run(Derived1 &dst, const Derived2 &src) + inline static void run(Derived1 &dst, const Derived2 &src) { dst.coeffRef(0, 0) = src.coeff(0, 0); } @@ -57,13 +57,13 @@ struct ei_triangular_assign_unroller<Derived1, Derived2, 1, Mode> template<typename Derived1, typename Derived2, int Mode> struct ei_triangular_assign_unroller<Derived1, Derived2, 0, Mode> { - static void run(Derived1 &, const Derived2 &) {} + inline static void run(Derived1 &, const Derived2 &) {} }; template<typename Derived1, typename Derived2, int Mode> struct ei_triangular_assign_unroller<Derived1, Derived2, Dynamic, Mode> { - static void run(Derived1 &, const Derived2 &) {} + inline static void run(Derived1 &, const Derived2 &) {} }; diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h index ac3ccc2cc..9dd8ef661 100644 --- a/Eigen/src/Core/Visitor.h +++ b/Eigen/src/Core/Visitor.h @@ -33,7 +33,7 @@ struct ei_visitor_unroller row = (UnrollCount-1) % Derived::RowsAtCompileTime }; - static void run(const Derived &mat, Visitor& visitor) + inline static void run(const Derived &mat, Visitor& visitor) { ei_visitor_unroller<Visitor, Derived, UnrollCount-1>::run(mat, visitor); visitor(mat.coeff(row, col), row, col); @@ -43,7 +43,7 @@ struct ei_visitor_unroller template<typename Visitor, typename Derived> struct ei_visitor_unroller<Visitor, Derived, 1> { - static void run(const Derived &mat, Visitor& visitor) + inline static void run(const Derived &mat, Visitor& visitor) { return visitor.init(mat.coeff(0, 0), 0, 0); } @@ -52,7 +52,7 @@ struct ei_visitor_unroller<Visitor, Derived, 1> template<typename Visitor, typename Derived> struct ei_visitor_unroller<Visitor, Derived, Dynamic> { - static void run(const Derived &, Visitor&) {} + inline static void run(const Derived &, Visitor&) {} }; @@ -100,7 +100,7 @@ struct ei_coeff_visitor { int row, col; Scalar res; - void init(const Scalar& value, int i, int j) + inline void init(const Scalar& value, int i, int j) { res = value; row = i; diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h index aec4e9312..b2627ae4b 100644 --- a/Eigen/src/Core/arch/AltiVec/PacketMath.h +++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h @@ -46,7 +46,7 @@ inline vector int ei_psub(const vector int a, const vector int b) { r inline vector float ei_pmul(const vector float a, const vector float b) { return vec_madd(a,b, v0f); } inline vector int ei_pmul(const vector int a, const vector int b) { - // Taken from http:// + // Taken from http://developer.apple.com/hardwaredrivers/ve/algorithms.html#Multiply32 //Set up constants vector int bswap, lowProduct, highProduct; diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 4b8c5fedb..306144218 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -86,9 +86,9 @@ using Eigen::MatrixBase; // Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const' // : function body not available #if EIGEN_GNUC_AT_LEAST(4,0) -#define EIGEN_INLINE __attribute__((always_inline)) +#define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline #else -#define EIGEN_INLINE inline +#define EIGEN_ALWAYS_INLINE inline #endif #if (defined __GNUC__) |