From e8cdbedefb1913b5a0e2f2b7d38470f081cb8d29 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Thu, 4 Dec 2014 22:48:53 +0100 Subject: bug #877, bug #572: Introduce a global Index typedef. Rename Sparse*::Index to StorageIndex, make Dense*::StorageIndex an alias to DenseIndex. Overall this commit gets rid of all Index conversion warnings. --- Eigen/src/Core/ArrayBase.h | 1 - Eigen/src/Core/AssignEvaluator.h | 52 ++++++++++++++++---------------------- Eigen/src/Core/BandMatrix.h | 12 ++++----- Eigen/src/Core/Block.h | 14 +++++----- Eigen/src/Core/CommaInitializer.h | 2 +- Eigen/src/Core/CoreEvaluators.h | 30 +++++++++++----------- Eigen/src/Core/CoreIterators.h | 18 ++++++------- Eigen/src/Core/CwiseBinaryOp.h | 8 +++--- Eigen/src/Core/CwiseUnaryOp.h | 4 +-- Eigen/src/Core/DenseBase.h | 14 +++++++--- Eigen/src/Core/DenseCoeffsBase.h | 4 --- Eigen/src/Core/Diagonal.h | 24 +++++++++--------- Eigen/src/Core/DiagonalMatrix.h | 8 +++--- Eigen/src/Core/EigenBase.h | 8 +++--- Eigen/src/Core/MapBase.h | 1 - Eigen/src/Core/Matrix.h | 2 +- Eigen/src/Core/MatrixBase.h | 3 ++- Eigen/src/Core/PermutationMatrix.h | 16 ++++++------ Eigen/src/Core/PlainObjectBase.h | 3 --- Eigen/src/Core/Product.h | 10 ++++---- Eigen/src/Core/ProductEvaluators.h | 22 ++++++++-------- Eigen/src/Core/ReturnByValue.h | 4 +-- Eigen/src/Core/SelfAdjointView.h | 4 +-- Eigen/src/Core/Solve.h | 7 ++--- Eigen/src/Core/StableNorm.h | 1 - Eigen/src/Core/Swap.h | 2 +- Eigen/src/Core/Transpose.h | 10 +++----- Eigen/src/Core/TriangularMatrix.h | 18 ++++++------- Eigen/src/Core/util/Macros.h | 22 +++++----------- Eigen/src/Core/util/XprHelper.h | 17 +++++++++++++ 30 files changed, 167 insertions(+), 174 deletions(-) (limited to 'Eigen/src/Core') diff --git a/Eigen/src/Core/ArrayBase.h b/Eigen/src/Core/ArrayBase.h index d42693d4b..82c12076e 100644 --- a/Eigen/src/Core/ArrayBase.h +++ b/Eigen/src/Core/ArrayBase.h @@ -50,7 +50,6 @@ template class ArrayBase typename NumTraits::Scalar>::Real>::operator*; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index 4db10e697..506bace69 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h @@ -179,20 +179,20 @@ struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +template struct copy_using_evaluator_DefaultTraversal_InnerUnrolling { - EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, typename Kernel::Index outer) + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) { - kernel.assignCoeffByOuterInner(outer, Index); - copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + kernel.assignCoeffByOuterInner(outer, Index_); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); } }; template struct copy_using_evaluator_DefaultTraversal_InnerUnrolling { - EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, typename Kernel::Index) { } + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index) { } }; /*********************** @@ -246,13 +246,13 @@ struct copy_using_evaluator_innervec_CompleteUnrolling EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } }; -template +template struct copy_using_evaluator_innervec_InnerUnrolling { - EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, typename Kernel::Index outer) + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) { - kernel.template assignPacketByOuterInner(outer, Index); - enum { NextIndex = Index + packet_traits::size }; + kernel.template assignPacketByOuterInner(outer, Index_); + enum { NextIndex = Index_ + packet_traits::size }; copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); } }; @@ -260,7 +260,7 @@ struct copy_using_evaluator_innervec_InnerUnrolling template struct copy_using_evaluator_innervec_InnerUnrolling { - EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, typename Kernel::Index) { } + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, Index) { } }; /*************************************************************************** @@ -283,8 +283,6 @@ struct dense_assignment_loop { EIGEN_DEVICE_FUNC static void run(Kernel &kernel) { - typedef typename Kernel::Index Index; - for(Index outer = 0; outer < kernel.outerSize(); ++outer) { for(Index inner = 0; inner < kernel.innerSize(); ++inner) { kernel.assignCoeffByOuterInner(outer, inner); @@ -306,7 +304,7 @@ struct dense_assignment_loop template struct dense_assignment_loop { - typedef typename Kernel::Index Index; + typedef typename Kernel::StorageIndex StorageIndex; EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) { typedef typename Kernel::DstEvaluatorType::XprType DstXprType; @@ -330,7 +328,7 @@ struct unaligned_dense_assignment_loop { // if IsAligned = true, then do nothing template - EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, typename Kernel::Index, typename Kernel::Index) {} + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index, Index) {} }; template <> @@ -342,16 +340,16 @@ struct unaligned_dense_assignment_loop #if EIGEN_COMP_MSVC template static EIGEN_DONT_INLINE void run(Kernel &kernel, - typename Kernel::Index start, - typename Kernel::Index end) + Index start, + Index end) #else template EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, - typename Kernel::Index start, - typename Kernel::Index end) + Index start, + Index end) #endif { - for (typename Kernel::Index index = start; index < end; ++index) + for (Index index = start; index < end; ++index) kernel.assignCoeff(index); } }; @@ -361,8 +359,6 @@ struct dense_assignment_loop { EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) { - typedef typename Kernel::Index Index; - const Index size = kernel.size(); typedef packet_traits PacketTraits; enum { @@ -386,7 +382,7 @@ struct dense_assignment_loop template struct dense_assignment_loop { - typedef typename Kernel::Index Index; + typedef typename Kernel::StorageIndex StorageIndex; EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) { typedef typename Kernel::DstEvaluatorType::XprType DstXprType; @@ -409,8 +405,6 @@ struct dense_assignment_loop { EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) { - typedef typename Kernel::Index Index; - const Index innerSize = kernel.innerSize(); const Index outerSize = kernel.outerSize(); const Index packetSize = packet_traits::size; @@ -433,7 +427,7 @@ struct dense_assignment_loop struct dense_assignment_loop { - typedef typename Kernel::Index Index; + typedef typename Kernel::StorageIndex StorageIndex; EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) { typedef typename Kernel::DstEvaluatorType::XprType DstXprType; @@ -452,7 +446,6 @@ struct dense_assignment_loop { EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) { - typedef typename Kernel::Index Index; const Index size = kernel.size(); for(Index i = 0; i < size; ++i) kernel.assignCoeff(i); @@ -478,7 +471,6 @@ struct dense_assignment_loop { EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) { - typedef typename Kernel::Index Index; typedef packet_traits PacketTraits; enum { packetSize = PacketTraits::size, @@ -533,7 +525,7 @@ public: typedef DstEvaluatorTypeT DstEvaluatorType; typedef SrcEvaluatorTypeT SrcEvaluatorType; typedef typename DstEvaluatorType::Scalar Scalar; - typedef typename DstEvaluatorType::Index Index; + typedef typename DstEvaluatorType::StorageIndex StorageIndex; typedef copy_using_evaluator_traits AssignmentTraits; @@ -731,8 +723,8 @@ EIGEN_DEVICE_FUNC void call_assignment_no_alias(Dst& dst, const Src& src, const && int(Dst::SizeAtCompileTime) != 1 }; - typename Dst::Index dstRows = NeedToTranspose ? src.cols() : src.rows(); - typename Dst::Index dstCols = NeedToTranspose ? src.rows() : src.cols(); + Index dstRows = NeedToTranspose ? src.cols() : src.rows(); + Index dstCols = NeedToTranspose ? src.rows() : src.cols(); if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) dst.resize(dstRows, dstCols); diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index e59ee3da9..d07ea7056 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -32,7 +32,7 @@ class BandMatrixBase : public EigenBase }; typedef typename internal::traits::Scalar Scalar; typedef Matrix DenseMatrixType; - typedef typename DenseMatrixType::Index Index; + typedef typename DenseMatrixType::StorageIndex StorageIndex; typedef typename internal::traits::CoefficientsType CoefficientsType; typedef EigenBase Base; @@ -179,7 +179,7 @@ struct traits > { typedef _Scalar Scalar; typedef Dense StorageKind; - typedef DenseIndex Index; + typedef DenseIndex StorageIndex; enum { CoeffReadCost = NumTraits::ReadCost, RowsAtCompileTime = _Rows, @@ -201,7 +201,7 @@ class BandMatrix : public BandMatrixBase::Scalar Scalar; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::CoefficientsType CoefficientsType; explicit inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) @@ -241,7 +241,7 @@ struct traits::CoeffReadCost, RowsAtCompileTime = _Rows, @@ -264,7 +264,7 @@ class BandMatrixWrapper : public BandMatrixBase::Scalar Scalar; typedef typename internal::traits::CoefficientsType CoefficientsType; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; explicit inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) : m_coeffs(coeffs), @@ -312,7 +312,7 @@ template class TridiagonalMatrix : public BandMatrix { typedef BandMatrix Base; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; public: explicit TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 9cf9d5432..6ea383695 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -154,7 +154,7 @@ class BlockImpl : public internal::BlockImpl_dense { typedef internal::BlockImpl_dense Impl; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; public: typedef Impl Base; EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl) @@ -306,13 +306,13 @@ template m_startRow; - const internal::variable_if_dynamic m_startCol; - const internal::variable_if_dynamic m_blockRows; - const internal::variable_if_dynamic m_blockCols; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + const internal::variable_if_dynamic m_blockRows; + const internal::variable_if_dynamic m_blockCols; }; /** \internal Internal implementation of dense Blocks in the direct access case.*/ diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index 70cbfeff5..98ebe3bf6 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -28,7 +28,7 @@ template struct CommaInitializer { typedef typename XprType::Scalar Scalar; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; EIGEN_DEVICE_FUNC inline CommaInitializer(XprType& xpr, const Scalar& s) diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index a0dc72c4d..eb35b44cb 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -111,7 +111,7 @@ struct evaluator_base typedef evaluator type; typedef evaluator nestedType; - typedef typename traits::Index Index; + typedef typename traits::StorageIndex StorageIndex; // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices. typedef traits ExpressionTraits; }; @@ -128,7 +128,7 @@ struct evaluator > : evaluator_base { typedef PlainObjectBase PlainObjectType; - typedef typename PlainObjectType::Index Index; + typedef typename PlainObjectType::StorageIndex StorageIndex; typedef typename PlainObjectType::Scalar Scalar; typedef typename PlainObjectType::CoeffReturnType CoeffReturnType; typedef typename PlainObjectType::PacketScalar PacketScalar; @@ -264,7 +264,7 @@ struct unary_evaluator, IndexBased> EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {} - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -343,7 +343,7 @@ struct evaluator > : m_functor(n.functor()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -394,7 +394,7 @@ struct unary_evaluator, IndexBased > m_argImpl(op.nestedExpression()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -469,7 +469,7 @@ struct binary_evaluator, IndexBased, IndexBase m_rhsImpl(xpr.rhs()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -522,7 +522,7 @@ struct unary_evaluator, IndexBased> m_argImpl(op.nestedExpression()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; @@ -563,7 +563,7 @@ struct mapbase_evaluator : evaluator_base { typedef Derived XprType; typedef typename XprType::PointerType PointerType; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -760,7 +760,7 @@ struct unary_evaluator, IndexBa m_startCol(block.startCol()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -865,7 +865,7 @@ struct evaluator > m_elseImpl(select.elseMatrix()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::CoeffReturnType CoeffReturnType; inline EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const @@ -898,7 +898,7 @@ struct unary_evaluator > : evaluator_base > { typedef Replicate XprType; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketReturnType PacketReturnType; enum { @@ -981,7 +981,7 @@ struct evaluator > : m_expr(expr) {} - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::CoeffReturnType CoeffReturnType; EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const @@ -1016,7 +1016,7 @@ struct evaluator_wrapper_base EIGEN_DEVICE_FUNC explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {} - typedef typename ArgType::Index Index; + typedef typename ArgType::StorageIndex StorageIndex; typedef typename ArgType::Scalar Scalar; typedef typename ArgType::CoeffReturnType CoeffReturnType; typedef typename ArgType::PacketScalar PacketScalar; @@ -1103,7 +1103,7 @@ struct unary_evaluator > : evaluator_base > { typedef Reverse XprType; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -1219,7 +1219,7 @@ struct evaluator > m_index(diagonal.index()) { } - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; diff --git a/Eigen/src/Core/CoreIterators.h b/Eigen/src/Core/CoreIterators.h index 7feebc4e4..141eaa2eb 100644 --- a/Eigen/src/Core/CoreIterators.h +++ b/Eigen/src/Core/CoreIterators.h @@ -36,7 +36,7 @@ protected: typedef internal::inner_iterator_selector::Kind> IteratorType; typedef typename internal::evaluator::type EvaluatorType; typedef typename internal::traits::Scalar Scalar; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; public: /** Construct an iterator over the \a outerId -th row or column of \a xpr */ InnerIterator(const XprType &xpr, const Index &outerId) @@ -50,11 +50,11 @@ public: */ EIGEN_STRONG_INLINE InnerIterator& operator++() { m_iter.operator++(); return *this; } /// \returns the column or row index of the current coefficient. - EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); } + EIGEN_STRONG_INLINE StorageIndex index() const { return m_iter.index(); } /// \returns the row index of the current coefficient. - EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); } + EIGEN_STRONG_INLINE StorageIndex row() const { return m_iter.row(); } /// \returns the column index of the current coefficient. - EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); } + EIGEN_STRONG_INLINE StorageIndex col() const { return m_iter.col(); } /// \returns \c true if the iterator \c *this still references a valid coefficient. EIGEN_STRONG_INLINE operator bool() const { return m_iter; } @@ -77,7 +77,7 @@ class inner_iterator_selector protected: typedef typename evaluator::type EvaluatorType; typedef typename traits::Scalar Scalar; - typedef typename traits::Index Index; + typedef typename traits::StorageIndex StorageIndex; enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; public: @@ -93,9 +93,9 @@ public: EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++; return *this; } - EIGEN_STRONG_INLINE Index index() const { return m_inner; } - inline Index row() const { return IsRowMajor ? m_outer : index(); } - inline Index col() const { return IsRowMajor ? index() : m_outer; } + EIGEN_STRONG_INLINE StorageIndex index() const { return m_inner; } + inline StorageIndex row() const { return IsRowMajor ? m_outer : index(); } + inline StorageIndex col() const { return IsRowMajor ? index() : m_outer; } EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } @@ -115,7 +115,7 @@ class inner_iterator_selector protected: typedef typename evaluator::InnerIterator Base; typedef typename evaluator::type EvaluatorType; - typedef typename traits::Index Index; + typedef typename traits::StorageIndex StorageIndex; public: EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &/*innerSize*/) diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index a205c3f10..4d4626279 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -59,8 +59,8 @@ struct traits > typedef typename cwise_promote_storage_type::StorageKind, typename traits::StorageKind, BinaryOp>::ret StorageKind; - typedef typename promote_index_type::Index, - typename traits::Index>::type Index; + typedef typename promote_index_type::StorageIndex, + typename traits::StorageIndex>::type StorageIndex; typedef typename Lhs::Nested LhsNested; typedef typename Rhs::Nested RhsNested; typedef typename remove_reference::type _LhsNested; @@ -111,7 +111,7 @@ class CwiseBinaryOp : } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE Index rows() const { + EIGEN_STRONG_INLINE StorageIndex rows() const { // return the fixed size type if available to enable compile time optimizations if (internal::traits::type>::RowsAtCompileTime==Dynamic) return m_rhs.rows(); @@ -119,7 +119,7 @@ class CwiseBinaryOp : return m_lhs.rows(); } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE Index cols() const { + EIGEN_STRONG_INLINE StorageIndex cols() const { // return the fixed size type if available to enable compile time optimizations if (internal::traits::type>::ColsAtCompileTime==Dynamic) return m_rhs.cols(); diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index da1d1992d..5388af216 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -66,9 +66,9 @@ class CwiseUnaryOp : public CwiseUnaryOpImpl class DenseBase typedef typename internal::traits::StorageKind StorageKind; - /** \brief The type of indices + /** \brief The interface type of indices * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. - * \sa \ref TopicPreprocessorDirectives. + * \sa \ref TopicPreprocessorDirectives, StorageIndex. */ - typedef typename internal::traits::Index Index; + typedef Eigen::Index Index; + + /** + * \brief The type used to store indices + * \details This typedef is relevant for types that store multiple indices such as + * PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index + * \sa \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase. + */ + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h index a9e4dbaf9..569fed956 100644 --- a/Eigen/src/Core/DenseCoeffsBase.h +++ b/Eigen/src/Core/DenseCoeffsBase.h @@ -35,7 +35,6 @@ class DenseCoeffsBase : public EigenBase { public: typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; @@ -287,7 +286,6 @@ class DenseCoeffsBase : public DenseCoeffsBase Base; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -450,7 +448,6 @@ class DenseCoeffsBase : public DenseCoeffsBase Base; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -525,7 +522,6 @@ class DenseCoeffsBase public: typedef DenseCoeffsBase Base; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h index 33b82f90f..18f061179 100644 --- a/Eigen/src/Core/Diagonal.h +++ b/Eigen/src/Core/Diagonal.h @@ -70,28 +70,28 @@ template class Diagonal EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) EIGEN_DEVICE_FUNC - explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {} + explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(internal::convert_index(a_index)) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) EIGEN_DEVICE_FUNC - inline Index rows() const + inline StorageIndex rows() const { - return m_index.value()<0 ? numext::mini(Index(m_matrix.cols()),Index(m_matrix.rows()+m_index.value())) - : numext::mini(Index(m_matrix.rows()),Index(m_matrix.cols()-m_index.value())); + return m_index.value()<0 ? numext::mini(m_matrix.cols(),m_matrix.rows()+m_index.value()) + : numext::mini(m_matrix.rows(),m_matrix.cols()-m_index.value()); } EIGEN_DEVICE_FUNC - inline Index cols() const { return 1; } + inline StorageIndex cols() const { return 1; } EIGEN_DEVICE_FUNC - inline Index innerStride() const + inline StorageIndex innerStride() const { return m_matrix.outerStride() + 1; } EIGEN_DEVICE_FUNC - inline Index outerStride() const + inline StorageIndex outerStride() const { return 0; } @@ -153,23 +153,23 @@ template class Diagonal } EIGEN_DEVICE_FUNC - inline Index index() const + inline StorageIndex index() const { return m_index.value(); } protected: typename MatrixType::Nested m_matrix; - const internal::variable_if_dynamicindex m_index; + const internal::variable_if_dynamicindex m_index; private: // some compilers may fail to optimize std::max etc in case of compile-time constants... EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_STRONG_INLINE StorageIndex absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_STRONG_INLINE StorageIndex rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } + EIGEN_STRONG_INLINE StorageIndex colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } // trigger a compile time error is someone try to call packet template typename MatrixType::PacketReturnType packet(Index) const; template typename MatrixType::PacketReturnType packet(Index,Index) const; diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index e3dc71336..f37091000 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -22,7 +22,7 @@ class DiagonalBase : public EigenBase typedef typename DiagonalVectorType::Scalar Scalar; typedef typename DiagonalVectorType::RealScalar RealScalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; enum { RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, @@ -108,7 +108,7 @@ struct traits > { typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; typedef DiagonalShape StorageKind; - typedef DenseIndex Index; +// typedef DenseIndex Index; enum { Flags = LvalueBit | NoPreferredStorageOrderBit }; @@ -124,7 +124,7 @@ class DiagonalMatrix typedef const DiagonalMatrix& Nested; typedef _Scalar Scalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; #endif protected: @@ -230,7 +230,7 @@ struct traits > { typedef _DiagonalVectorType DiagonalVectorType; typedef typename DiagonalVectorType::Scalar Scalar; - typedef typename DiagonalVectorType::Index Index; + typedef typename DiagonalVectorType::StorageIndex StorageIndex; typedef DiagonalShape StorageKind; typedef typename traits::XprKind XprKind; enum { diff --git a/Eigen/src/Core/EigenBase.h b/Eigen/src/Core/EigenBase.h index 52b66e6dc..c98ca467a 100644 --- a/Eigen/src/Core/EigenBase.h +++ b/Eigen/src/Core/EigenBase.h @@ -28,7 +28,7 @@ template struct EigenBase // typedef typename internal::plain_matrix_type::type PlainObject; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; /** \returns a reference to the derived object */ EIGEN_DEVICE_FUNC @@ -46,14 +46,14 @@ template struct EigenBase /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ EIGEN_DEVICE_FUNC - inline Index rows() const { return derived().rows(); } + inline StorageIndex rows() const { return derived().rows(); } /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ EIGEN_DEVICE_FUNC - inline Index cols() const { return derived().cols(); } + inline StorageIndex cols() const { return derived().cols(); } /** \returns the number of coefficients, which is rows()*cols(). * \sa rows(), cols(), SizeAtCompileTime. */ EIGEN_DEVICE_FUNC - inline Index size() const { return rows() * cols(); } + inline StorageIndex size() const { return rows() * cols(); } /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ template diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index 3c67edae5..3dafee9d7 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -37,7 +37,6 @@ template class MapBase }; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 0b3d90786..94b1a966e 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -107,7 +107,7 @@ struct traits > { typedef _Scalar Scalar; typedef Dense StorageKind; - typedef DenseIndex Index; + typedef DenseIndex StorageIndex; typedef MatrixXpr XprKind; enum { RowsAtCompileTime = _Rows, diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 86994cb36..5c00d6a63 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -52,7 +52,8 @@ template class MatrixBase #ifndef EIGEN_PARSED_BY_DOXYGEN typedef MatrixBase StorageBaseType; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef Eigen::Index Index; + typedef Index StorageIndex; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h index 4846f2ae1..886d59a2c 100644 --- a/Eigen/src/Core/PermutationMatrix.h +++ b/Eigen/src/Core/PermutationMatrix.h @@ -67,7 +67,7 @@ class PermutationBase : public EigenBase MaxColsAtCompileTime = Traits::MaxColsAtCompileTime }; typedef typename Traits::StorageIndexType StorageIndexType; - typedef typename Traits::Index Index; + typedef typename Traits::StorageIndex StorageIndex; typedef Matrix DenseMatrixType; typedef PermutationMatrix @@ -277,7 +277,7 @@ struct traits IndicesType; - typedef typename IndicesType::Index Index; + typedef typename IndicesType::StorageIndex StorageIndex; typedef _StorageIndexType StorageIndexType; }; } @@ -294,7 +294,7 @@ class PermutationMatrix : public PermutationBase, _PacketAccess> IndicesType; - typedef typename IndicesType::Index Index; + typedef typename IndicesType::StorageIndex StorageIndex; typedef _StorageIndexType StorageIndexType; }; } @@ -418,7 +418,7 @@ class Map > typedef PermutationStorage StorageKind; typedef typename _IndicesType::Scalar Scalar; typedef typename _IndicesType::Scalar StorageIndexType; - typedef typename _IndicesType::Index Index; + typedef typename _IndicesType::StorageIndex StorageIndex; typedef _IndicesType IndicesType; enum { RowsAtCompileTime = _IndicesType::SizeAtCompileTime, @@ -558,7 +558,7 @@ struct permut_matrix_product_retval : public ReturnByValue > { typedef typename remove_all::type MatrixTypeNestedCleaned; - typedef typename MatrixType::Index Index; + typedef typename MatrixType::StorageIndex StorageIndex; permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) : m_permutation(perm), m_matrix(matrix) @@ -650,7 +650,7 @@ class Transpose > MaxColsAtCompileTime = Traits::MaxColsAtCompileTime }; typedef typename Traits::Scalar Scalar; - typedef typename Traits::Index Index; + typedef typename Traits::StorageIndex StorageIndex; #endif Transpose(const PermutationType& p) : m_permutation(p) {} diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 06e326a05..65d69f484 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -95,7 +95,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type typedef typename internal::dense_xpr_base::type Base; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -846,7 +845,6 @@ namespace internal { template struct conservative_resize_like_impl { - typedef typename Derived::Index Index; static void run(DenseBase& _this, Index rows, Index cols) { if (_this.rows() == rows && _this.cols() == cols) return; @@ -912,7 +910,6 @@ struct conservative_resize_like_impl { using conservative_resize_like_impl::run; - typedef typename Derived::Index Index; static void run(DenseBase& _this, Index size) { const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size; diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index cb79543ef..8ff13fbba 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -67,8 +67,8 @@ struct traits > typedef typename product_promote_storage_type::ret>::ret StorageKind; - typedef typename promote_index_type::type Index; + typedef typename promote_index_type::type StorageIndex; enum { RowsAtCompileTime = LhsTraits::RowsAtCompileTime, @@ -120,8 +120,8 @@ class Product : public ProductImpl<_Lhs,_Rhs,Option, && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); } - EIGEN_DEVICE_FUNC inline Index rows() const { return m_lhs.rows(); } - EIGEN_DEVICE_FUNC inline Index cols() const { return m_rhs.cols(); } + EIGEN_DEVICE_FUNC inline StorageIndex rows() const { return m_lhs.rows(); } + EIGEN_DEVICE_FUNC inline StorageIndex cols() const { return m_rhs.cols(); } EIGEN_DEVICE_FUNC const LhsNestedCleaned& lhs() const { return m_lhs; } EIGEN_DEVICE_FUNC const RhsNestedCleaned& rhs() const { return m_rhs; } @@ -149,7 +149,7 @@ class dense_product_base public: using Base::derived; typedef typename Base::Scalar Scalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; operator const Scalar() const { diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 3cebbbd12..b2c9b56ed 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -210,7 +210,6 @@ struct generic_product_impl template EIGEN_DONT_INLINE void outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const false_type&) { - typedef typename Dst::Index Index; // FIXME make sure lhs is sequentially stored // FIXME not very good if rhs is real and lhs complex while alpha is real too // FIXME we should probably build an evaluator for dst and rhs @@ -222,7 +221,6 @@ EIGEN_DONT_INLINE void outer_product_selector_run(Dst& dst, const Lhs &lhs, cons // Row major result template EIGEN_DONT_INLINE void outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const true_type&) { - typedef typename Dst::Index Index; // FIXME make sure rhs is sequentially stored // FIXME not very good if lhs is real and rhs complex while alpha is real too // FIXME we should probably build an evaluator for dst and lhs @@ -372,7 +370,7 @@ struct product_evaluator, ProductTag, DenseShape, : evaluator_base > { typedef Product XprType; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -524,7 +522,7 @@ struct product_evaluator, LazyCoeffBasedProduc template struct etor_product_packet_impl { - typedef typename Lhs::Index Index; + typedef typename Lhs::StorageIndex StorageIndex; static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) { etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); @@ -535,7 +533,7 @@ struct etor_product_packet_impl struct etor_product_packet_impl { - typedef typename Lhs::Index Index; + typedef typename Lhs::StorageIndex StorageIndex; static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) { etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); @@ -546,7 +544,7 @@ struct etor_product_packet_impl struct etor_product_packet_impl { - typedef typename Lhs::Index Index; + typedef typename Lhs::StorageIndex StorageIndex; static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) { res = pmul(pset1(lhs.coeff(row, 0)),rhs.template packet(0, col)); @@ -556,7 +554,7 @@ struct etor_product_packet_impl template struct etor_product_packet_impl { - typedef typename Lhs::Index Index; + typedef typename Lhs::StorageIndex StorageIndex; static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) { res = pmul(lhs.template packet(row, 0), pset1(rhs.coeff(0, col))); @@ -566,7 +564,7 @@ struct etor_product_packet_impl template struct etor_product_packet_impl { - typedef typename Lhs::Index Index; + typedef typename Lhs::StorageIndex StorageIndex; static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) { eigen_assert(innerDim>0 && "you are using a non initialized matrix"); @@ -579,7 +577,7 @@ struct etor_product_packet_impl template struct etor_product_packet_impl { - typedef typename Lhs::Index Index; + typedef typename Lhs::StorageIndex StorageIndex; static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) { eigen_assert(innerDim>0 && "you are using a non initialized matrix"); @@ -668,7 +666,7 @@ template { - typedef typename MatrixType::Index Index; + typedef typename MatrixType::StorageIndex StorageIndex; typedef typename scalar_product_traits::ReturnType Scalar; typedef typename internal::packet_traits::type PacketScalar; public: @@ -733,7 +731,7 @@ struct product_evaluator, ProductTag, DiagonalSha using Base::coeff; using Base::packet_impl; typedef typename Base::Scalar Scalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::PacketScalar PacketScalar; typedef Product XprType; @@ -781,7 +779,7 @@ struct product_evaluator, ProductTag, DenseShape, using Base::coeff; using Base::packet_impl; typedef typename Base::Scalar Scalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::PacketScalar PacketScalar; typedef Product XprType; diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index af01a5567..d2b80d872 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h @@ -61,8 +61,8 @@ template class ReturnByValue EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const { static_cast(this)->evalTo(dst); } - EIGEN_DEVICE_FUNC inline Index rows() const { return static_cast(this)->rows(); } - EIGEN_DEVICE_FUNC inline Index cols() const { return static_cast(this)->cols(); } + EIGEN_DEVICE_FUNC inline StorageIndex rows() const { return static_cast(this)->rows(); } + EIGEN_DEVICE_FUNC inline StorageIndex cols() const { return static_cast(this)->cols(); } #ifndef EIGEN_PARSED_BY_DOXYGEN #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index b785e8e1e..2d5760066 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -59,7 +59,7 @@ template class SelfAdjointView /** \brief The type of coefficients in this matrix */ typedef typename internal::traits::Scalar Scalar; - typedef typename MatrixType::Index Index; + typedef typename MatrixType::StorageIndex StorageIndex; enum { Mode = internal::traits::Mode, @@ -224,7 +224,7 @@ public: typedef typename Base::DstEvaluatorType DstEvaluatorType; typedef typename Base::SrcEvaluatorType SrcEvaluatorType; typedef typename Base::Scalar Scalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::AssignmentTraits AssignmentTraits; diff --git a/Eigen/src/Core/Solve.h b/Eigen/src/Core/Solve.h index 3905cd616..5a3a4235e 100644 --- a/Eigen/src/Core/Solve.h +++ b/Eigen/src/Core/Solve.h @@ -48,6 +48,7 @@ struct traits > : traits::StorageKind>::PlainObject> { typedef typename solve_traits::StorageKind>::PlainObject PlainObject; + typedef typename promote_index_type::type StorageIndex; typedef traits BaseTraits; enum { Flags = BaseTraits::Flags & RowMajorBit, @@ -62,15 +63,15 @@ template class Solve : public SolveImpl::StorageKind> { public: - typedef typename RhsType::Index Index; typedef typename internal::traits::PlainObject PlainObject; + typedef typename internal::traits::StorageIndex StorageIndex; Solve(const Decomposition &dec, const RhsType &rhs) : m_dec(dec), m_rhs(rhs) {} - EIGEN_DEVICE_FUNC Index rows() const { return m_dec.cols(); } - EIGEN_DEVICE_FUNC Index cols() const { return m_rhs.cols(); } + EIGEN_DEVICE_FUNC StorageIndex rows() const { return m_dec.cols(); } + EIGEN_DEVICE_FUNC StorageIndex cols() const { return m_rhs.cols(); } EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; } EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; } diff --git a/Eigen/src/Core/StableNorm.h b/Eigen/src/Core/StableNorm.h index 0b7e39827..83a973365 100644 --- a/Eigen/src/Core/StableNorm.h +++ b/Eigen/src/Core/StableNorm.h @@ -55,7 +55,6 @@ inline typename NumTraits::Scalar>::Real blueNorm_impl(const EigenBase& _vec) { typedef typename Derived::RealScalar RealScalar; - typedef typename Derived::Index Index; using std::pow; using std::sqrt; using std::abs; diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index 55319320a..3d4d8b802 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -28,7 +28,7 @@ protected: public: typedef typename Base::Scalar Scalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::DstXprType DstXprType; typedef swap_assign_op Functor; diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index a3b95256f..e1316a73d 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -29,14 +29,10 @@ namespace Eigen { namespace internal { template -struct traits > +struct traits > : public traits { - typedef typename traits::Scalar Scalar; - typedef typename traits::Index Index; typedef typename nested::type MatrixTypeNested; typedef typename remove_reference::type MatrixTypeNestedPlain; - typedef typename traits::StorageKind StorageKind; - typedef typename traits::XprKind XprKind; enum { RowsAtCompileTime = MatrixType::ColsAtCompileTime, ColsAtCompileTime = MatrixType::RowsAtCompileTime, @@ -68,8 +64,8 @@ template class Transpose EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) - EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.cols(); } - EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC inline StorageIndex rows() const { return m_matrix.cols(); } + EIGEN_DEVICE_FUNC inline StorageIndex cols() const { return m_matrix.rows(); } /** \returns the nested expression */ EIGEN_DEVICE_FUNC diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index cf0255bce..d8135be27 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -45,7 +45,7 @@ template class TriangularBase : public EigenBase }; typedef typename internal::traits::Scalar Scalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::FullMatrixType DenseMatrixType; typedef DenseMatrixType DenseType; typedef Derived const& Nested; @@ -54,9 +54,9 @@ template class TriangularBase : public EigenBase inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); } EIGEN_DEVICE_FUNC - inline Index rows() const { return derived().rows(); } + inline StorageIndex rows() const { return derived().rows(); } EIGEN_DEVICE_FUNC - inline Index cols() const { return derived().cols(); } + inline StorageIndex cols() const { return derived().cols(); } EIGEN_DEVICE_FUNC inline Index outerStride() const { return derived().outerStride(); } EIGEN_DEVICE_FUNC @@ -199,7 +199,7 @@ template class TriangularView public: typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::MatrixTypeNestedCleaned NestedExpression; enum { @@ -222,9 +222,9 @@ template class TriangularView { return Base::operator=(other); } EIGEN_DEVICE_FUNC - inline Index rows() const { return m_matrix.rows(); } + inline StorageIndex rows() const { return m_matrix.rows(); } EIGEN_DEVICE_FUNC - inline Index cols() const { return m_matrix.cols(); } + inline StorageIndex cols() const { return m_matrix.cols(); } EIGEN_DEVICE_FUNC const NestedExpression& nestedExpression() const { return m_matrix; } @@ -325,7 +325,7 @@ template class TriangularViewImpl<_Mat using Base::derived; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; enum { Mode = _Mode, @@ -688,7 +688,7 @@ public: typedef typename Base::DstEvaluatorType DstEvaluatorType; typedef typename Base::SrcEvaluatorType SrcEvaluatorType; typedef typename Base::Scalar Scalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::AssignmentTraits AssignmentTraits; @@ -831,7 +831,7 @@ struct triangular_assignment_loop template struct triangular_assignment_loop { - typedef typename Kernel::Index Index; + typedef typename Kernel::StorageIndex StorageIndex; typedef typename Kernel::Scalar Scalar; EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index bc26043d7..11b7e2887 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -629,7 +629,7 @@ namespace Eigen { typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \ typedef typename Eigen::internal::nested::type Nested; \ typedef typename Eigen::internal::traits::StorageKind StorageKind; \ - typedef typename Eigen::internal::traits::Index Index; \ + typedef typename Eigen::internal::traits::StorageIndex StorageIndex; \ enum { RowsAtCompileTime = Eigen::internal::traits::RowsAtCompileTime, \ ColsAtCompileTime = Eigen::internal::traits::ColsAtCompileTime, \ Flags = Eigen::internal::traits::Flags, \ @@ -639,23 +639,13 @@ namespace Eigen { #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ - typedef typename Eigen::internal::traits::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex. */ \ - typedef typename Eigen::NumTraits::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex, T were corresponding to RealScalar. */ \ + EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ typedef typename Base::PacketScalar PacketScalar; \ - typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \ - typedef typename Eigen::internal::nested::type Nested; \ - typedef typename Eigen::internal::traits::StorageKind StorageKind; \ - typedef typename Eigen::internal::traits::Index Index; \ - enum { RowsAtCompileTime = Eigen::internal::traits::RowsAtCompileTime, \ - ColsAtCompileTime = Eigen::internal::traits::ColsAtCompileTime, \ - MaxRowsAtCompileTime = Eigen::internal::traits::MaxRowsAtCompileTime, \ - MaxColsAtCompileTime = Eigen::internal::traits::MaxColsAtCompileTime, \ - Flags = Eigen::internal::traits::Flags, \ - SizeAtCompileTime = Base::SizeAtCompileTime, \ - MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \ - IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \ + typedef Eigen::Index Index; \ + enum { MaxRowsAtCompileTime = Eigen::internal::traits::MaxRowsAtCompileTime, \ + MaxColsAtCompileTime = Eigen::internal::traits::MaxColsAtCompileTime}; \ using Base::derived; \ - using Base::const_cast_derived; + using Base::const_cast_derived; #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b) #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b) diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 09866ad8d..299e5cbc2 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -26,8 +26,25 @@ namespace Eigen { typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex; +/** + * \brief The Index type as used for the API. + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \sa \ref TopicPreprocessorDirectives, StorageIndex. + */ + +typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE Index; + namespace internal { +template +EIGEN_DEVICE_FUNC +inline IndexDest convert_index(const IndexSrc& idx) { + // for sizeof(IndexDest)>=sizeof(IndexSrc) compilers should be able to optimize this away: + eigen_internal_assert(idx <= NumTraits::highest() && "Index value to big for target type"); + return IndexDest(idx); +} + + //classes inheriting no_assignment_operator don't generate a default operator=. class no_assignment_operator { -- cgit v1.2.3