diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-06-26 20:08:16 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-06-26 20:08:16 +0000 |
commit | c5bd1703cb05f60a00f948a222e3d61eaf7ab5ad (patch) | |
tree | b52758c0b2b6b7f609777e40152c8ae48d37d6a5 | |
parent | 25ba9f377c97968923cd654d419fa8ce260f114d (diff) |
change derived classes methods from "private:_method()"
to "public:method()" i.e. reimplementing the generic method()
from MatrixBase.
improves compilation speed by 7%, reduces almost by half the call depth
of trivial functions, making gcc errors and application backtraces
nicer...
-rw-r--r-- | Eigen/src/Array/PartialRedux.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/Block.h | 24 | ||||
-rw-r--r-- | Eigen/src/Core/Coeffs.h | 24 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseBinaryOp.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseNullaryOp.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseUnaryOp.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalCoeffs.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalMatrix.h | 8 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalProduct.h | 10 | ||||
-rwxr-xr-x | Eigen/src/Core/Extract.h | 8 | ||||
-rw-r--r-- | Eigen/src/Core/Flagged.h | 24 | ||||
-rw-r--r-- | Eigen/src/Core/Map.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/Matrix.h | 31 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/Minor.h | 10 | ||||
-rw-r--r-- | Eigen/src/Core/NestByValue.h | 24 | ||||
-rw-r--r-- | Eigen/src/Core/Product.h | 18 | ||||
-rw-r--r-- | Eigen/src/Core/Transpose.h | 16 | ||||
-rw-r--r-- | Eigen/src/LU/Inverse.h | 10 | ||||
-rw-r--r-- | Eigen/src/Sparse/SparseMatrix.h | 16 |
20 files changed, 137 insertions, 168 deletions
diff --git a/Eigen/src/Array/PartialRedux.h b/Eigen/src/Array/PartialRedux.h index aa85b6ac0..023372f8a 100644 --- a/Eigen/src/Array/PartialRedux.h +++ b/Eigen/src/Array/PartialRedux.h @@ -79,10 +79,10 @@ class PartialRedux : ei_no_assignment_operator, private: - int _rows() const { return (Direction==Vertical ? 1 : m_matrix.rows()); } - int _cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); } + int rows() const { return (Direction==Vertical ? 1 : m_matrix.rows()); } + int cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); } - const Scalar _coeff(int i, int j) const + const Scalar coeff(int i, int j) const { if (Direction==Vertical) return m_matrix.col(j).redux(m_functor); diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index e9f5bab29..33aeb78a3 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -134,25 +134,23 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) - private: + inline int rows() const { return m_blockRows.value(); } + inline int cols() const { return m_blockCols.value(); } - inline int _rows() const { return m_blockRows.value(); } - inline int _cols() const { return m_blockCols.value(); } + inline int stride(void) const { return m_matrix.stride(); } - inline int _stride(void) const { return m_matrix.stride(); } - - inline 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()); } - inline 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()); } - inline Scalar& _coeffRef(int index) + inline Scalar& coeffRef(int index) { return m_matrix.const_cast_derived() .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), @@ -160,7 +158,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block } - inline const Scalar _coeff(int index) const + inline const Scalar coeff(int index) const { return m_matrix .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), @@ -168,26 +166,26 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block } template<int LoadMode> - inline PacketScalar _packet(int row, int col) const + inline PacketScalar packet(int row, int col) const { return m_matrix.template packet<UnAligned>(row + m_startRow.value(), col + m_startCol.value()); } template<int LoadMode> - inline void _writePacket(int row, int col, const PacketScalar& x) + inline void writePacket(int row, int col, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacket<UnAligned>(row + m_startRow.value(), col + m_startCol.value(), x); } template<int LoadMode> - inline PacketScalar _packet(int index) const + inline PacketScalar packet(int index) const { return m_matrix.template packet<UnAligned>(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); } template<int LoadMode> - inline void _writePacket(int index, const PacketScalar& x) + inline void writePacket(int index, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacket<UnAligned> (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), diff --git a/Eigen/src/Core/Coeffs.h b/Eigen/src/Core/Coeffs.h index 53b551b19..cc8bc713c 100644 --- a/Eigen/src/Core/Coeffs.h +++ b/Eigen/src/Core/Coeffs.h @@ -45,7 +45,7 @@ inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> { ei_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived()._coeff(row, col); + return derived().coeff(row, col); } /** \returns the coefficient at given the given row and column. @@ -58,7 +58,7 @@ inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> { ei_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived()._coeff(row, col); + return derived().coeff(row, col); } /** Short version: don't use this function, use @@ -81,7 +81,7 @@ inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> { ei_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived()._coeffRef(row, col); + return derived().coeffRef(row, col); } /** \returns a reference to the coefficient at given the given row and column. @@ -94,7 +94,7 @@ inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> { ei_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived()._coeffRef(row, col); + return derived().coeffRef(row, col); } /** Short version: don't use this function, use @@ -116,7 +116,7 @@ inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::coeff(int index) const { ei_internal_assert(index >= 0 && index < size()); - return derived()._coeff(index); + return derived().coeff(index); } /** \returns the coefficient at given index. @@ -131,7 +131,7 @@ inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived> ::operator[](int index) const { ei_assert(index >= 0 && index < size()); - return derived()._coeff(index); + return derived().coeff(index); } /** Short version: don't use this function, use @@ -153,7 +153,7 @@ inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::coeffRef(int index) { ei_internal_assert(index >= 0 && index < size()); - return derived()._coeffRef(index); + return derived().coeffRef(index); } /** \returns a reference to the coefficient at given index. @@ -167,7 +167,7 @@ inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived> ::operator[](int index) { ei_assert(index >= 0 && index < size()); - return derived()._coeffRef(index); + return derived().coeffRef(index); } /** equivalent to operator[](0). */ @@ -225,7 +225,7 @@ MatrixBase<Derived>::packet(int row, int col) const { ei_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived().template _packet<LoadMode>(row,col); + return derived().template packet<LoadMode>(row,col); } /** Stores the given packet of coefficients, at the given row and column of this expression. It is your responsibility @@ -243,7 +243,7 @@ inline void MatrixBase<Derived>::writePacket { ei_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - derived().template _writePacket<StoreMode>(row,col,x); + derived().template writePacket<StoreMode>(row,col,x); } /** \returns the packet of coefficients starting at the given index. It is your responsibility @@ -260,7 +260,7 @@ inline typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type MatrixBase<Derived>::packet(int index) const { ei_internal_assert(index >= 0 && index < size()); - return derived().template _packet<LoadMode>(index); + return derived().template packet<LoadMode>(index); } /** Stores the given packet of coefficients, at the given index in this expression. It is your responsibility @@ -277,7 +277,7 @@ inline void MatrixBase<Derived>::writePacket (int index, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x) { ei_internal_assert(index >= 0 && index < size()); - derived().template _writePacket<StoreMode>(index,x); + derived().template writePacket<StoreMode>(index,x); } diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 6672edcbe..2441b30f6 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -92,29 +92,27 @@ class CwiseBinaryOp : ei_no_assignment_operator, ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - private: + inline int rows() const { return m_lhs.rows(); } + inline int cols() const { return m_lhs.cols(); } - inline int _rows() const { return m_lhs.rows(); } - inline int _cols() const { return m_lhs.cols(); } - - inline 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> - inline PacketScalar _packet(int row, int col) const + inline PacketScalar packet(int row, int col) const { return m_functor.packetOp(m_lhs.template packet<LoadMode>(row, col), m_rhs.template packet<LoadMode>(row, col)); } - inline const Scalar _coeff(int index) const + inline const Scalar coeff(int index) const { return m_functor(m_lhs.coeff(index), m_rhs.coeff(index)); } template<int LoadMode> - inline PacketScalar _packet(int index) const + inline PacketScalar packet(int index) const { return m_functor.packetOp(m_lhs.template packet<LoadMode>(index), m_rhs.template packet<LoadMode>(index)); } diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 998b7ce56..78ecb878b 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -75,29 +75,27 @@ class CwiseNullaryOp : ei_no_assignment_operator, && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - private: + int rows() const { return m_rows.value(); } + int cols() const { return m_cols.value(); } - int _rows() const { return m_rows.value(); } - int _cols() const { return m_cols.value(); } - - const Scalar _coeff(int rows, int cols) const + const Scalar coeff(int rows, int cols) const { return m_functor(rows, cols); } template<int LoadMode> - PacketScalar _packet(int, int) const + PacketScalar packet(int, int) const { return m_functor.packetOp(); } - const Scalar _coeff(int index) const + const Scalar coeff(int index) const { return m_functor(index); } template<int LoadMode> - PacketScalar _packet(int) const + PacketScalar packet(int) const { return m_functor.packetOp(); } diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index 881853d28..c80124b47 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -74,29 +74,27 @@ class CwiseUnaryOp : ei_no_assignment_operator, inline CwiseUnaryOp(const MatrixType& mat, const UnaryOp& func = UnaryOp()) : m_matrix(mat), m_functor(func) {} - private: + inline int rows() const { return m_matrix.rows(); } + inline int cols() const { return m_matrix.cols(); } - inline int _rows() const { return m_matrix.rows(); } - inline int _cols() const { return m_matrix.cols(); } - - inline 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> - inline PacketScalar _packet(int row, int col) const + inline PacketScalar packet(int row, int col) const { return m_functor.packetOp(m_matrix.template packet<LoadMode>(row, col)); } - inline const Scalar _coeff(int index) const + inline const Scalar coeff(int index) const { return m_functor(m_matrix.coeff(index)); } template<int LoadMode> - inline PacketScalar _packet(int index) const + inline PacketScalar packet(int index) const { return m_functor.packetOp(m_matrix.template packet<LoadMode>(index)); } diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h index 516d52526..2560d73bc 100644 --- a/Eigen/src/Core/DiagonalCoeffs.h +++ b/Eigen/src/Core/DiagonalCoeffs.h @@ -73,27 +73,25 @@ template<typename MatrixType> class DiagonalCoeffs EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs) - private: + inline int rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); } + inline int cols() const { return 1; } - inline int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); } - inline int _cols() const { return 1; } - - inline Scalar& _coeffRef(int row, int) + inline Scalar& coeffRef(int row, int) { return m_matrix.const_cast_derived().coeffRef(row, row); } - inline const Scalar _coeff(int row, int) const + inline const Scalar coeff(int row, int) const { return m_matrix.coeff(row, row); } - inline Scalar& _coeffRef(int index) + inline Scalar& coeffRef(int index) { return m_matrix.const_cast_derived().coeffRef(index, index); } - inline const Scalar _coeff(int index) const + inline const Scalar coeff(int index) const { return m_matrix.coeff(index, index); } diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 2a5b618e8..34bd7ebf3 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -68,12 +68,10 @@ class DiagonalMatrix : ei_no_assignment_operator, && coeffs.size() > 0); } - private: + inline int rows() const { return m_coeffs.size(); } + inline int cols() const { return m_coeffs.size(); } - inline int _rows() const { return m_coeffs.size(); } - inline int _cols() const { return m_coeffs.size(); } - - inline 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); } diff --git a/Eigen/src/Core/DiagonalProduct.h b/Eigen/src/Core/DiagonalProduct.h index 38d6ad46b..1a2338487 100644 --- a/Eigen/src/Core/DiagonalProduct.h +++ b/Eigen/src/Core/DiagonalProduct.h @@ -82,19 +82,17 @@ template<typename LhsNested, typename RhsNested> class Product<LhsNested, RhsNes ei_assert(lhs.cols() == rhs.rows()); } - private: + inline int rows() const { return m_lhs.rows(); } + inline 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 + const Scalar coeff(int row, int col) const { const int unique = RhsIsDiagonal ? col : row; return m_lhs.coeff(row, unique) * m_rhs.coeff(unique, col); } template<int LoadMode> - const PacketScalar _packet(int row, int col) const + const PacketScalar packet(int row, int col) const { if (RhsIsDiagonal) { diff --git a/Eigen/src/Core/Extract.h b/Eigen/src/Core/Extract.h index 473ff7d6b..516178c2c 100755 --- a/Eigen/src/Core/Extract.h +++ b/Eigen/src/Core/Extract.h @@ -69,12 +69,10 @@ template<typename MatrixType, unsigned int Mode> class Extract EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Extract) - private: + inline int rows() const { return m_matrix.rows(); } + inline int cols() const { return m_matrix.cols(); } - inline int _rows() const { return m_matrix.rows(); } - inline int _cols() const { return m_matrix.cols(); } - - inline Scalar _coeff(int row, int col) const + inline Scalar coeff(int row, int col) const { if(Flags & LowerTriangularBit ? col>row : row>col) return (Flags & SelfAdjointBit) ? ei_conj(m_matrix.coeff(col, row)) : (Scalar)0; diff --git a/Eigen/src/Core/Flagged.h b/Eigen/src/Core/Flagged.h index 8afd068c4..c4b464ce2 100644 --- a/Eigen/src/Core/Flagged.h +++ b/Eigen/src/Core/Flagged.h @@ -68,52 +68,50 @@ template<typename ExpressionType, unsigned int Added, unsigned int Removed> clas /** \internal */ inline const ExpressionType& _expression() const { return m_matrix; } - private: + inline int rows() const { return m_matrix.rows(); } + inline int cols() const { return m_matrix.cols(); } + inline int stride() const { return m_matrix.stride(); } - inline int _rows() const { return m_matrix.rows(); } - inline int _cols() const { return m_matrix.cols(); } - inline int _stride() const { return m_matrix.stride(); } - - inline const Scalar _coeff(int row, int col) const + inline const Scalar coeff(int row, int col) const { return m_matrix.coeff(row, col); } - inline Scalar& _coeffRef(int row, int col) + inline Scalar& coeffRef(int row, int col) { return m_matrix.const_cast_derived().coeffRef(row, col); } - inline const Scalar _coeff(int index) const + inline const Scalar coeff(int index) const { return m_matrix.coeff(index); } - inline Scalar& _coeffRef(int index) + inline Scalar& coeffRef(int index) { return m_matrix.const_cast_derived().coeffRef(index); } template<int LoadMode> - inline const PacketScalar _packet(int row, int col) const + inline const PacketScalar packet(int row, int col) const { return m_matrix.template packet<LoadMode>(row, col); } template<int LoadMode> - inline void _writePacket(int row, int col, const PacketScalar& x) + inline void writePacket(int row, int col, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacket<LoadMode>(row, col, x); } template<int LoadMode> - inline const PacketScalar _packet(int index) const + inline const PacketScalar packet(int index) const { return m_matrix.template packet<LoadMode>(index); } template<int LoadMode> - inline void _writePacket(int index, const PacketScalar& x) + inline void writePacket(int index, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacket<LoadMode>(index, x); } diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index bcd72bdb8..335c2a85f 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -59,12 +59,10 @@ template<typename MatrixType> class Map EIGEN_GENERIC_PUBLIC_INTERFACE(Map) - private: + inline int rows() const { return m_rows; } + inline int cols() const { return m_cols; } - inline int _rows() const { return m_rows; } - inline int _cols() const { return m_cols; } - - inline 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 +70,7 @@ template<typename MatrixType> class Map return m_data[row + col * m_rows]; } - inline 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]; @@ -80,12 +78,12 @@ template<typename MatrixType> class Map return const_cast<Scalar*>(m_data)[row + col * m_rows]; } - inline const Scalar& _coeff(int index) const + inline const Scalar& coeff(int index) const { return m_data[index]; } - inline Scalar& _coeffRef(int index) + inline Scalar& coeffRef(int index) { return m_data[index]; } diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 3d037cbee..40947e997 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -100,19 +100,18 @@ template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, uns class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags> > { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix) - friend class Map<Matrix>; - - private: - + protected: ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage; - inline int _rows() const { return m_storage.rows(); } - inline int _cols() const { return m_storage.cols(); } + public: + friend class Map<Matrix>; + + inline int rows() const { return m_storage.rows(); } + inline int cols() const { return m_storage.cols(); } - inline int _stride(void) const + inline int stride(void) const { if(Flags & RowMajorBit) return m_storage.cols(); @@ -120,7 +119,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol return m_storage.rows(); } - inline 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()]; @@ -128,12 +127,12 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol return m_storage.data()[row + col * m_storage.rows()]; } - inline const Scalar& _coeff(int index) const + inline const Scalar& coeff(int index) const { return m_storage.data()[index]; } - inline 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()]; @@ -141,13 +140,13 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol return m_storage.data()[row + col * m_storage.rows()]; } - inline Scalar& _coeffRef(int index) + inline Scalar& coeffRef(int index) { return m_storage.data()[index]; } template<int LoadMode> - inline PacketScalar _packet(int row, int col) const + inline PacketScalar packet(int row, int col) const { if(Flags & RowMajorBit) if (LoadMode==Aligned) @@ -162,7 +161,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol } template<int LoadMode> - inline PacketScalar _packet(int index) const + inline PacketScalar packet(int index) const { if (LoadMode==Aligned) return ei_pload(m_storage.data() + index); @@ -171,7 +170,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol } template<int StoreMode> - inline void _writePacket(int row, int col, const PacketScalar& x) + inline void writePacket(int row, int col, const PacketScalar& x) { ei_internal_assert(Flags & PacketAccessBit); if(Flags & RowMajorBit) @@ -187,7 +186,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCol } template<int StoreMode> - inline void _writePacket(int index, const PacketScalar& x) + inline void writePacket(int index, const PacketScalar& x) { if (StoreMode==Aligned) ei_pstore(m_storage.data() + index, x); diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index f503ebcbf..06ee74214 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -148,9 +148,9 @@ template<typename Derived> class MatrixBase typedef typename NumTraits<Scalar>::Real RealScalar; /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ - inline int rows() const { return derived()._rows(); } + inline int rows() const { return derived().rows(); } /** \returns the number of columns. \sa row(), ColsAtCompileTime*/ - inline 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. */ inline int size() const { return rows() * cols(); } @@ -433,7 +433,7 @@ template<typename Derived> class MatrixBase * Combined with coeffRef() and the \ref flags flags, it allows a direct access to the data * of the underlying matrix. */ - inline int stride(void) const { return derived()._stride(); } + inline int stride(void) const { return derived().stride(); } inline const NestByValue<Derived> nestByValue() const; diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h index d22f41982..9e87c9b9b 100644 --- a/Eigen/src/Core/Minor.h +++ b/Eigen/src/Core/Minor.h @@ -74,17 +74,15 @@ template<typename MatrixType> class Minor EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor) - private: + inline int rows() const { return m_matrix.rows() - 1; } + inline 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; } - - inline 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)); } - inline 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)); } diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index a63202dfd..86d8795cd 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h @@ -60,52 +60,50 @@ template<typename ExpressionType> class NestByValue inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} - private: + inline int rows() const { return m_expression.rows(); } + inline int cols() const { return m_expression.cols(); } + inline int stride() const { return m_expression.stride(); } - inline int _rows() const { return m_expression.rows(); } - inline int _cols() const { return m_expression.cols(); } - inline int _stride() const { return m_expression.stride(); } - - inline const Scalar _coeff(int row, int col) const + inline const Scalar coeff(int row, int col) const { return m_expression.coeff(row, col); } - inline Scalar& _coeffRef(int row, int col) + inline Scalar& coeffRef(int row, int col) { return m_expression.const_cast_derived().coeffRef(row, col); } - inline const Scalar _coeff(int index) const + inline const Scalar coeff(int index) const { return m_expression.coeff(index); } - inline Scalar& _coeffRef(int index) + inline Scalar& coeffRef(int index) { return m_expression.const_cast_derived().coeffRef(index); } template<int LoadMode> - inline const PacketScalar _packet(int row, int col) const + inline const PacketScalar packet(int row, int col) const { return m_expression.template packet<LoadMode>(row, col); } template<int LoadMode> - inline void _writePacket(int row, int col, const PacketScalar& x) + inline void writePacket(int row, int col, const PacketScalar& x) { m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x); } template<int LoadMode> - inline const PacketScalar _packet(int index) const + inline const PacketScalar packet(int index) const { return m_expression.template packet<LoadMode>(index); } template<int LoadMode> - inline void _writePacket(int index, const PacketScalar& x) + inline void writePacket(int index, const PacketScalar& x) { m_expression.const_cast_derived().template writePacket<LoadMode>(index, x); } diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index df35ffc4f..a0b29449c 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -206,17 +206,15 @@ template<typename LhsNested, typename RhsNested, int ProductMode> class Product * \returns whether it is worth it to use the cache friendly product. */ inline bool _useCacheFriendlyProduct() const { - return _rows()>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD - && _cols()>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD + return rows()>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD + && cols()>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD && m_lhs.cols()>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD; } - private: - - inline int _rows() const { return m_lhs.rows(); } - inline 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 + const Scalar coeff(int row, int col) const { Scalar res; ScalarCoeffImpl::run(row, col, m_lhs, m_rhs, res); @@ -226,7 +224,7 @@ template<typename LhsNested, typename RhsNested, int ProductMode> class Product /* Allow index-based non-packet access. It is impossible though to allow index-based packed access, * which is why we don't set the LinearAccessBit. */ - const Scalar _coeff(int index) const + const Scalar coeff(int index) const { Scalar res; const int row = RowsAtCompileTime == 1 ? 0 : index; @@ -236,7 +234,7 @@ template<typename LhsNested, typename RhsNested, int ProductMode> class Product } template<int LoadMode> - const PacketScalar _packet(int row, int col) const + const PacketScalar packet(int row, int col) const { PacketScalar res; ei_product_packet_impl<Flags&RowMajorBit ? RowMajorProduct : ColMajorProduct, @@ -508,7 +506,7 @@ inline void Product<Lhs,Rhs,ProductMode>::_cacheFriendlyEvalAndAdd(DestDerived& LhsCopy lhs(m_lhs); RhsCopy rhs(m_rhs); ei_cache_friendly_product<Scalar>( - _rows(), _cols(), lhs.cols(), + rows(), cols(), lhs.cols(), _LhsCopy::Flags&RowMajorBit, &(lhs.const_cast_derived().coeffRef(0,0)), lhs.stride(), _RhsCopy::Flags&RowMajorBit, &(rhs.const_cast_derived().coeffRef(0,0)), rhs.stride(), Flags&RowMajorBit, &(res.coeffRef(0,0)), res.stride() diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index ddac5fa63..f19d4affa 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -67,31 +67,29 @@ template<typename MatrixType> class Transpose EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) - private: + inline int rows() const { return m_matrix.cols(); } + inline int cols() const { return m_matrix.rows(); } - inline int _rows() const { return m_matrix.cols(); } - inline int _cols() const { return m_matrix.rows(); } + inline int stride(void) const { return m_matrix.stride(); } - inline int _stride(void) const { return m_matrix.stride(); } - - inline Scalar& _coeffRef(int row, int col) + inline Scalar& coeffRef(int row, int col) { return m_matrix.const_cast_derived().coeffRef(col, row); } - inline 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> - inline const PacketScalar _packet(int row, int col) const + inline const PacketScalar packet(int row, int col) const { return m_matrix.template packet<LoadMode>(col, row); } template<int LoadMode> - inline void _writePacket(int row, int col, const PacketScalar& x) + inline void writePacket(int row, int col, const PacketScalar& x) { m_matrix.const_cast_derived().template writePacket<LoadMode>(col, row, x); } diff --git a/Eigen/src/LU/Inverse.h b/Eigen/src/LU/Inverse.h index e8d81a991..a4f703383 100644 --- a/Eigen/src/LU/Inverse.h +++ b/Eigen/src/LU/Inverse.h @@ -76,18 +76,16 @@ template<typename MatrixType, bool CheckExistence> class Inverse : ei_no_assignm */ bool exists() const { assert(CheckExistence); return m_exists; } - private: + int rows() const { return m_inverse.rows(); } + int cols() const { return m_inverse.cols(); } - int _rows() const { return m_inverse.rows(); } - int _cols() const { return m_inverse.cols(); } - - const Scalar _coeff(int row, int col) const + const Scalar coeff(int row, int col) const { return m_inverse.coeff(row, col); } template<int LoadMode> - PacketScalar _packet(int row, int col) const + PacketScalar packet(int row, int col) const { return m_inverse.template packet<LoadMode>(row, col); } diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h index 74a85da0d..d3ee6e3b1 100644 --- a/Eigen/src/Sparse/SparseMatrix.h +++ b/Eigen/src/Sparse/SparseMatrix.h @@ -63,10 +63,10 @@ class SparseMatrix : public MatrixBase<SparseMatrix<_Scalar> > int m_rows; int m_cols; - inline int _rows() const { return m_rows; } - inline int _cols() const { return m_cols; } + inline int rows() const { return m_rows; } + inline int cols() const { return m_cols; } - inline const Scalar& _coeff(int row, int col) const + inline const Scalar& coeff(int row, int col) const { int id = m_colPtrs[col]; int end = m_colPtrs[col+1]; @@ -79,7 +79,7 @@ class SparseMatrix : public MatrixBase<SparseMatrix<_Scalar> > return m_data.value(id); } - inline Scalar& _coeffRef(int row, int col) + inline Scalar& coeffRef(int row, int col) { int id = m_colPtrs[cols]; int end = m_colPtrs[cols+1]; @@ -95,19 +95,19 @@ class SparseMatrix : public MatrixBase<SparseMatrix<_Scalar> > class InnerIterator; - inline int rows() const { return _rows(); } - inline int cols() const { return _cols(); } + inline int rows() const { return rows(); } + inline int cols() const { return cols(); } /** \returns the number of non zero coefficients */ inline int nonZeros() const { return m_data.size(); } inline const Scalar& operator() (int row, int col) const { - return _coeff(row, col); + return coeff(row, col); } inline Scalar& operator() (int row, int col) { - return _coeffRef(row, col); + return coeffRef(row, col); } inline void startFill(int reserveSize = 1000) |