diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-02-13 18:57:41 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-02-13 18:57:41 +0100 |
commit | fc202bab398ed9b78ef8452f8e4ef35e233965f6 (patch) | |
tree | f0f427ee115aa8579b0d43a49c2ad762b1b0f57c /Eigen | |
parent | fe513199808654bfa5080fe16bda7dcdafbd57c6 (diff) |
Index refactoring: StorageIndex must be used for storage only (and locally when it make sense). In all other cases use the global Index type.
Diffstat (limited to 'Eigen')
65 files changed, 428 insertions, 468 deletions
diff --git a/Eigen/src/Core/BooleanRedux.h b/Eigen/src/Core/BooleanRedux.h index dac1887e0..31fbb9214 100644 --- a/Eigen/src/Core/BooleanRedux.h +++ b/Eigen/src/Core/BooleanRedux.h @@ -130,7 +130,7 @@ inline bool DenseBase<Derived>::any() const * \sa all(), any() */ template<typename Derived> -inline typename DenseBase<Derived>::Index DenseBase<Derived>::count() const +inline Eigen::Index DenseBase<Derived>::count() const { return derived().template cast<bool>().template cast<Index>().sum(); } diff --git a/Eigen/src/Core/CoreIterators.h b/Eigen/src/Core/CoreIterators.h index 141eaa2eb..c76bdf68e 100644 --- a/Eigen/src/Core/CoreIterators.h +++ b/Eigen/src/Core/CoreIterators.h @@ -36,7 +36,6 @@ protected: typedef internal::inner_iterator_selector<XprType, typename internal::evaluator_traits<XprType>::Kind> IteratorType; typedef typename internal::evaluator<XprType>::type EvaluatorType; typedef typename internal::traits<XprType>::Scalar Scalar; - typedef typename internal::traits<XprType>::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 +49,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 StorageIndex index() const { return m_iter.index(); } + EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); } /// \returns the row index of the current coefficient. - EIGEN_STRONG_INLINE StorageIndex row() const { return m_iter.row(); } + EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); } /// \returns the column index of the current coefficient. - EIGEN_STRONG_INLINE StorageIndex col() const { return m_iter.col(); } + EIGEN_STRONG_INLINE Index 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 +76,6 @@ class inner_iterator_selector<XprType, IndexBased> protected: typedef typename evaluator<XprType>::type EvaluatorType; typedef typename traits<XprType>::Scalar Scalar; - typedef typename traits<XprType>::StorageIndex StorageIndex; enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; public: @@ -93,9 +91,9 @@ public: EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++; return *this; } - 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 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 operator bool() const { return m_inner < m_end && m_inner>=0; } @@ -115,7 +113,6 @@ class inner_iterator_selector<XprType, IteratorBased> protected: typedef typename evaluator<XprType>::InnerIterator Base; typedef typename evaluator<XprType>::type EvaluatorType; - typedef typename traits<XprType>::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 4d4626279..0c9d9fbf2 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -111,7 +111,7 @@ class CwiseBinaryOp : } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE StorageIndex rows() const { + EIGEN_STRONG_INLINE Index rows() const { // return the fixed size type if available to enable compile time optimizations if (internal::traits<typename internal::remove_all<LhsNested>::type>::RowsAtCompileTime==Dynamic) return m_rhs.rows(); @@ -119,7 +119,7 @@ class CwiseBinaryOp : return m_lhs.rows(); } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE StorageIndex cols() const { + EIGEN_STRONG_INLINE Index cols() const { // return the fixed size type if available to enable compile time optimizations if (internal::traits<typename internal::remove_all<LhsNested>::type>::ColsAtCompileTime==Dynamic) return m_rhs.cols(); diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 628fc61fa..322daad8f 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -58,16 +58,10 @@ template<typename Derived> class DenseBase typedef typename internal::traits<Derived>::StorageKind StorageKind; - /** \brief The interface type of indices - * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. - * \sa \ref TopicPreprocessorDirectives, StorageIndex. - */ - 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 + * \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<Derived>::StorageIndex StorageIndex; @@ -76,7 +70,8 @@ template<typename Derived> class DenseBase typedef typename internal::packet_traits<Scalar>::type PacketScalar; typedef typename NumTraits<Scalar>::Real RealScalar; - typedef DenseCoeffsBase<Derived> Base; + typedef internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar, + typename NumTraits<typename internal::traits<Derived>::Scalar>::Real> Base; using Base::derived; using Base::const_cast_derived; using Base::rows; diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h index 18f061179..2446a18d4 100644 --- a/Eigen/src/Core/Diagonal.h +++ b/Eigen/src/Core/Diagonal.h @@ -70,28 +70,28 @@ template<typename MatrixType, int _DiagIndex> class Diagonal EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) EIGEN_DEVICE_FUNC - explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(internal::convert_index<StorageIndex>(a_index)) {} + explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) EIGEN_DEVICE_FUNC - inline StorageIndex rows() const + inline Index rows() const { - return m_index.value()<0 ? numext::mini<StorageIndex>(m_matrix.cols(),m_matrix.rows()+m_index.value()) - : numext::mini<StorageIndex>(m_matrix.rows(),m_matrix.cols()-m_index.value()); + return m_index.value()<0 ? numext::mini<Index>(m_matrix.cols(),m_matrix.rows()+m_index.value()) + : numext::mini<Index>(m_matrix.rows(),m_matrix.cols()-m_index.value()); } EIGEN_DEVICE_FUNC - inline StorageIndex cols() const { return 1; } + inline Index cols() const { return 1; } EIGEN_DEVICE_FUNC - inline StorageIndex innerStride() const + inline Index innerStride() const { return m_matrix.outerStride() + 1; } EIGEN_DEVICE_FUNC - inline StorageIndex outerStride() const + inline Index outerStride() const { return 0; } @@ -153,23 +153,23 @@ template<typename MatrixType, int _DiagIndex> class Diagonal } EIGEN_DEVICE_FUNC - inline StorageIndex index() const + inline Index index() const { return m_index.value(); } protected: typename MatrixType::Nested m_matrix; - const internal::variable_if_dynamicindex<StorageIndex, DiagIndex> m_index; + const internal::variable_if_dynamicindex<Index, DiagIndex> m_index; private: // some compilers may fail to optimize std::max etc in case of compile-time constants... EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE StorageIndex absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE StorageIndex rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE StorageIndex colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } + EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } // trigger a compile time error is someone try to call packet template<int LoadMode> typename MatrixType::PacketReturnType packet(Index) const; template<int LoadMode> typename MatrixType::PacketReturnType packet(Index,Index) const; diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 56beaf3bc..5a9e3abd4 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -108,7 +108,6 @@ struct traits<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> > { typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; typedef DiagonalShape StorageKind; -// typedef DenseIndex Index; enum { Flags = LvalueBit | NoPreferredStorageOrderBit }; diff --git a/Eigen/src/Core/EigenBase.h b/Eigen/src/Core/EigenBase.h index c98ca467a..79dabda37 100644 --- a/Eigen/src/Core/EigenBase.h +++ b/Eigen/src/Core/EigenBase.h @@ -13,7 +13,9 @@ namespace Eigen { -/** Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). +/** \class EigenBase + * + * Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). * * In other words, an EigenBase object is an object that can be copied into a MatrixBase. * @@ -26,9 +28,16 @@ namespace Eigen { template<typename Derived> struct EigenBase { // typedef typename internal::plain_matrix_type<Derived>::type PlainObject; - + + /** \brief The interface type of indices + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \deprecated Since Eigen 3.3, its usage is deprecated. Use Eigen::Index instead. + * \sa StorageIndex, \ref TopicPreprocessorDirectives. + */ + typedef Eigen::Index Index; + + // FIXME is it needed? typedef typename internal::traits<Derived>::StorageKind StorageKind; - typedef typename internal::traits<Derived>::StorageIndex StorageIndex; /** \returns a reference to the derived object */ EIGEN_DEVICE_FUNC @@ -46,14 +55,14 @@ template<typename Derived> struct EigenBase /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ EIGEN_DEVICE_FUNC - inline StorageIndex rows() const { return derived().rows(); } + inline Index rows() const { return derived().rows(); } /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ EIGEN_DEVICE_FUNC - inline StorageIndex cols() const { return derived().cols(); } + inline Index cols() const { return derived().cols(); } /** \returns the number of coefficients, which is rows()*cols(). * \sa rows(), cols(), SizeAtCompileTime. */ EIGEN_DEVICE_FUNC - inline StorageIndex size() const { return rows() * cols(); } + inline Index size() const { return rows() * cols(); } /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ template<typename Dest> diff --git a/Eigen/src/Core/Inverse.h b/Eigen/src/Core/Inverse.h index f3b0dff87..f3fa82a01 100644 --- a/Eigen/src/Core/Inverse.h +++ b/Eigen/src/Core/Inverse.h @@ -45,7 +45,7 @@ template<typename XprType> class Inverse : public InverseImpl<XprType,typename internal::traits<XprType>::StorageKind> { public: - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::PlainObject PlainObject; typedef typename internal::nested<XprType>::type XprTypeNested; typedef typename internal::remove_all<XprTypeNested>::type XprTypeNestedCleaned; diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 5c00d6a63..ed28b4d07 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -52,8 +52,7 @@ template<typename Derived> class MatrixBase #ifndef EIGEN_PARSED_BY_DOXYGEN typedef MatrixBase StorageBaseType; typedef typename internal::traits<Derived>::StorageKind StorageKind; - typedef Eigen::Index Index; - typedef Index StorageIndex; + typedef typename internal::traits<Derived>::StorageIndex StorageIndex; typedef typename internal::traits<Derived>::Scalar Scalar; typedef typename internal::packet_traits<Scalar>::type PacketScalar; typedef typename NumTraits<Scalar>::Real RealScalar; diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h index 886d59a2c..1da27c06c 100644 --- a/Eigen/src/Core/PermutationMatrix.h +++ b/Eigen/src/Core/PermutationMatrix.h @@ -66,11 +66,10 @@ class PermutationBase : public EigenBase<Derived> MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = Traits::MaxColsAtCompileTime }; - typedef typename Traits::StorageIndexType StorageIndexType; typedef typename Traits::StorageIndex StorageIndex; - typedef Matrix<StorageIndexType,RowsAtCompileTime,ColsAtCompileTime,0,MaxRowsAtCompileTime,MaxColsAtCompileTime> + typedef Matrix<StorageIndex,RowsAtCompileTime,ColsAtCompileTime,0,MaxRowsAtCompileTime,MaxColsAtCompileTime> DenseMatrixType; - typedef PermutationMatrix<IndicesType::SizeAtCompileTime,IndicesType::MaxSizeAtCompileTime,StorageIndexType> + typedef PermutationMatrix<IndicesType::SizeAtCompileTime,IndicesType::MaxSizeAtCompileTime,StorageIndex> PlainPermutationType; using Base::derived; typedef Transpose<PermutationBase> TransposeReturnType; @@ -148,7 +147,7 @@ class PermutationBase : public EigenBase<Derived> /** Sets *this to be the identity permutation matrix */ void setIdentity() { - for(StorageIndexType i = 0; i < size(); ++i) + for(Index i = 0; i < size(); ++i) indices().coeffRef(i) = i; } @@ -174,8 +173,8 @@ class PermutationBase : public EigenBase<Derived> eigen_assert(i>=0 && j>=0 && i<size() && j<size()); for(Index k = 0; k < size(); ++k) { - if(indices().coeff(k) == i) indices().coeffRef(k) = StorageIndexType(j); - else if(indices().coeff(k) == j) indices().coeffRef(k) = StorageIndexType(i); + if(indices().coeff(k) == i) indices().coeffRef(k) = StorageIndex(j); + else if(indices().coeff(k) == j) indices().coeffRef(k) = StorageIndex(i); } return derived(); } @@ -263,7 +262,7 @@ class PermutationBase : public EigenBase<Derived> * * \param SizeAtCompileTime the number of rows/cols, or Dynamic * \param MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. - * \param StorageIndexType the integer type of the indices + * \param StorageIndex the integer type of the indices * * This class represents a permutation matrix, internally stored as a vector of integers. * @@ -271,19 +270,18 @@ class PermutationBase : public EigenBase<Derived> */ namespace internal { -template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndexType> -struct traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndexType> > - : traits<Matrix<_StorageIndexType,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > +template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndex> +struct traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex> > + : traits<Matrix<_StorageIndex,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > { typedef PermutationStorage StorageKind; - typedef Matrix<_StorageIndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; - typedef typename IndicesType::StorageIndex StorageIndex; - typedef _StorageIndexType StorageIndexType; + typedef Matrix<_StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; + typedef _StorageIndex StorageIndex; }; } -template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndexType> -class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndexType> > +template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndex> +class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex> > { typedef PermutationBase<PermutationMatrix> Base; typedef internal::traits<PermutationMatrix> Traits; @@ -293,7 +291,6 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename Traits::IndicesType IndicesType; - typedef typename Traits::StorageIndexType StorageIndexType; typedef typename Traits::StorageIndex StorageIndex; #endif @@ -304,7 +301,7 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile */ explicit inline PermutationMatrix(Index size) : m_indices(size) { - eigen_internal_assert(size <= NumTraits<StorageIndexType>::highest()); + eigen_internal_assert(size <= NumTraits<StorageIndex>::highest()); } /** Copy constructor. */ @@ -376,9 +373,9 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile PermutationMatrix(const Transpose<PermutationBase<Other> >& other) : m_indices(other.nestedPermutation().size()) { - eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndexType>::highest()); - StorageIndexType end = StorageIndexType(m_indices.size()); - for (StorageIndexType i=0; i<end;++i) + eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndex>::highest()); + StorageIndex end = StorageIndex(m_indices.size()); + for (StorageIndex i=0; i<end;++i) m_indices.coeffRef(other.nestedPermutation().indices().coeff(i)) = i; } template<typename Lhs,typename Rhs> @@ -396,20 +393,19 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile namespace internal { -template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndexType, int _PacketAccess> -struct traits<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndexType>,_PacketAccess> > - : traits<Matrix<_StorageIndexType,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > +template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndex, int _PacketAccess> +struct traits<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex>,_PacketAccess> > + : traits<Matrix<_StorageIndex,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > { typedef PermutationStorage StorageKind; - typedef Map<const Matrix<_StorageIndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>, _PacketAccess> IndicesType; - typedef typename IndicesType::StorageIndex StorageIndex; - typedef _StorageIndexType StorageIndexType; + typedef Map<const Matrix<_StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>, _PacketAccess> IndicesType; + typedef _StorageIndex StorageIndex; }; } -template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndexType, int _PacketAccess> -class Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndexType>,_PacketAccess> - : public PermutationBase<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndexType>,_PacketAccess> > +template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _StorageIndex, int _PacketAccess> +class Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex>,_PacketAccess> + : public PermutationBase<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageIndex>,_PacketAccess> > { typedef PermutationBase<Map> Base; typedef internal::traits<Map> Traits; @@ -417,15 +413,14 @@ class Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _StorageInd #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename Traits::IndicesType IndicesType; - typedef typename IndicesType::Scalar StorageIndexType; - typedef typename IndicesType::StorageIndex StorageIndex; + typedef typename IndicesType::Scalar StorageIndex; #endif - inline Map(const StorageIndexType* indicesPtr) + inline Map(const StorageIndex* indicesPtr) : m_indices(indicesPtr) {} - inline Map(const StorageIndexType* indicesPtr, Index size) + inline Map(const StorageIndex* indicesPtr, Index size) : m_indices(indicesPtr,size) {} @@ -479,8 +474,7 @@ struct traits<PermutationWrapper<_IndicesType> > { typedef PermutationStorage StorageKind; typedef typename _IndicesType::Scalar Scalar; - typedef typename _IndicesType::Scalar StorageIndexType; - typedef typename _IndicesType::StorageIndex StorageIndex; + typedef typename _IndicesType::Scalar StorageIndex; typedef _IndicesType IndicesType; enum { RowsAtCompileTime = _IndicesType::SizeAtCompileTime, diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 8ff13fbba..74b895792 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -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 StorageIndex rows() const { return m_lhs.rows(); } - EIGEN_DEVICE_FUNC inline StorageIndex cols() const { return m_rhs.cols(); } + 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 const LhsNestedCleaned& lhs() const { return m_lhs; } EIGEN_DEVICE_FUNC const RhsNestedCleaned& rhs() const { return m_rhs; } @@ -149,7 +149,6 @@ class dense_product_base<Lhs, Rhs, Option, InnerProduct> public: using Base::derived; typedef typename Base::Scalar Scalar; - typedef typename Base::StorageIndex StorageIndex; operator const Scalar() const { diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 7f9d135f7..d84e7776b 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -373,7 +373,6 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape, : evaluator_base<Product<Lhs, Rhs, LazyProduct> > { typedef Product<Lhs, Rhs, LazyProduct> XprType; - typedef typename XprType::StorageIndex StorageIndex; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::PacketScalar PacketScalar; @@ -525,7 +524,6 @@ struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProduc template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode> struct etor_product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode> { - 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<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, innerDim, res); @@ -536,7 +534,6 @@ struct etor_product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, Load template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode> struct etor_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode> { - 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<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, innerDim, res); @@ -547,7 +544,6 @@ struct etor_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, Load template<typename Lhs, typename Rhs, typename Packet, int LoadMode> struct etor_product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode> { - 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<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col)); @@ -557,7 +553,6 @@ struct etor_product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode> template<typename Lhs, typename Rhs, typename Packet, int LoadMode> struct etor_product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode> { - 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<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col))); @@ -567,7 +562,6 @@ struct etor_product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode> template<typename Lhs, typename Rhs, typename Packet, int LoadMode> struct etor_product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode> { - 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"); @@ -580,7 +574,6 @@ struct etor_product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode> template<typename Lhs, typename Rhs, typename Packet, int LoadMode> struct etor_product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode> { - 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"); @@ -669,7 +662,6 @@ template<typename MatrixType, typename DiagonalType, typename Derived, int Produ struct diagonal_product_evaluator_base : evaluator_base<Derived> { - typedef typename MatrixType::StorageIndex StorageIndex; typedef typename scalar_product_traits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar; typedef typename internal::packet_traits<Scalar>::type PacketScalar; public: @@ -734,7 +726,6 @@ struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DiagonalSha using Base::coeff; using Base::packet_impl; typedef typename Base::Scalar Scalar; - typedef typename Base::StorageIndex StorageIndex; typedef typename Base::PacketScalar PacketScalar; typedef Product<Lhs, Rhs, ProductKind> XprType; @@ -782,7 +773,6 @@ struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DenseShape, using Base::coeff; using Base::packet_impl; typedef typename Base::Scalar Scalar; - typedef typename Base::StorageIndex StorageIndex; typedef typename Base::PacketScalar PacketScalar; typedef Product<Lhs, Rhs, ProductKind> XprType; diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index d2b80d872..af01a5567 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h @@ -61,8 +61,8 @@ template<typename Derived> class ReturnByValue EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const { static_cast<const Derived*>(this)->evalTo(dst); } - EIGEN_DEVICE_FUNC inline StorageIndex rows() const { return static_cast<const Derived*>(this)->rows(); } - EIGEN_DEVICE_FUNC inline StorageIndex cols() const { return static_cast<const Derived*>(this)->cols(); } + EIGEN_DEVICE_FUNC inline Index rows() const { return static_cast<const Derived*>(this)->rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return static_cast<const Derived*>(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 2d5760066..a05746ad2 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -58,7 +58,6 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView /** \brief The type of coefficients in this matrix */ typedef typename internal::traits<SelfAdjointView>::Scalar Scalar; - typedef typename MatrixType::StorageIndex StorageIndex; enum { @@ -224,7 +223,6 @@ public: typedef typename Base::DstEvaluatorType DstEvaluatorType; typedef typename Base::SrcEvaluatorType SrcEvaluatorType; typedef typename Base::Scalar Scalar; - 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 5a3a4235e..47446b49e 100644 --- a/Eigen/src/Core/Solve.h +++ b/Eigen/src/Core/Solve.h @@ -70,8 +70,8 @@ public: : m_dec(dec), m_rhs(rhs) {} - EIGEN_DEVICE_FUNC StorageIndex rows() const { return m_dec.cols(); } - EIGEN_DEVICE_FUNC StorageIndex cols() const { return m_rhs.cols(); } + EIGEN_DEVICE_FUNC Index rows() const { return m_dec.cols(); } + EIGEN_DEVICE_FUNC Index 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/Swap.h b/Eigen/src/Core/Swap.h index 3d4d8b802..dcb42821f 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -28,7 +28,6 @@ protected: public: typedef typename Base::Scalar Scalar; - typedef typename Base::StorageIndex StorageIndex; typedef typename Base::DstXprType DstXprType; typedef swap_assign_op<Scalar> Functor; diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 5d60ba149..7e41769a3 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -64,8 +64,8 @@ template<typename MatrixType> class Transpose EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) - EIGEN_DEVICE_FUNC inline StorageIndex rows() const { return m_matrix.cols(); } - EIGEN_DEVICE_FUNC inline StorageIndex cols() const { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.cols(); } + EIGEN_DEVICE_FUNC inline Index 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 d8135be27..fd53ae4cb 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -54,9 +54,9 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived> inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); } EIGEN_DEVICE_FUNC - inline StorageIndex rows() const { return derived().rows(); } + inline Index rows() const { return derived().rows(); } EIGEN_DEVICE_FUNC - inline StorageIndex cols() const { return derived().cols(); } + inline Index cols() const { return derived().cols(); } EIGEN_DEVICE_FUNC inline Index outerStride() const { return derived().outerStride(); } EIGEN_DEVICE_FUNC @@ -199,7 +199,6 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView public: typedef typename internal::traits<TriangularView>::StorageKind StorageKind; - typedef typename internal::traits<TriangularView>::StorageIndex StorageIndex; typedef typename internal::traits<TriangularView>::MatrixTypeNestedCleaned NestedExpression; enum { @@ -222,9 +221,9 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView { return Base::operator=(other); } EIGEN_DEVICE_FUNC - inline StorageIndex rows() const { return m_matrix.rows(); } + inline Index rows() const { return m_matrix.rows(); } EIGEN_DEVICE_FUNC - inline StorageIndex cols() const { return m_matrix.cols(); } + inline Index cols() const { return m_matrix.cols(); } EIGEN_DEVICE_FUNC const NestedExpression& nestedExpression() const { return m_matrix; } @@ -325,7 +324,6 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularViewImpl<_Mat using Base::derived; typedef typename internal::traits<TriangularViewType>::StorageKind StorageKind; - typedef typename internal::traits<TriangularViewType>::StorageIndex StorageIndex; enum { Mode = _Mode, @@ -688,7 +686,6 @@ public: typedef typename Base::DstEvaluatorType DstEvaluatorType; typedef typename Base::SrcEvaluatorType SrcEvaluatorType; typedef typename Base::Scalar Scalar; - typedef typename Base::StorageIndex StorageIndex; typedef typename Base::AssignmentTraits AssignmentTraits; @@ -831,7 +828,6 @@ struct triangular_assignment_loop<Kernel, Mode, 0, SetOpposite> template<typename Kernel, unsigned int Mode, bool SetOpposite> struct triangular_assignment_loop<Kernel, Mode, Dynamic, SetOpposite> { - typedef typename Kernel::StorageIndex StorageIndex; typedef typename Kernel::Scalar Scalar; EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel) diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index 54842b5ff..34d337c90 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -66,7 +66,7 @@ template<typename _Scalar, int _Dim, int _Mode, int _Options> struct traits<Transform<_Scalar,_Dim,_Mode,_Options> > { typedef _Scalar Scalar; - typedef DenseIndex StorageIndex; + typedef Eigen::Index StorageIndex; typedef Dense StorageKind; enum { Dim1 = _Dim==Dynamic ? _Dim : _Dim + 1, @@ -204,8 +204,9 @@ public: }; /** the scalar type of the coefficients */ typedef _Scalar Scalar; - typedef DenseIndex StorageIndex; - typedef DenseIndex Index; + typedef Eigen::Index StorageIndex; + /** \deprecated */ + typedef Eigen::Index Index; /** type of the matrix used to represent the transformation */ typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type MatrixType; /** constified MatrixType */ diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h index bf2bb59ab..74cd0a472 100644 --- a/Eigen/src/Householder/HouseholderSequence.h +++ b/Eigen/src/Householder/HouseholderSequence.h @@ -87,7 +87,6 @@ struct hseq_side_dependent_impl { typedef Block<const VectorsType, Dynamic, 1> EssentialVectorType; typedef HouseholderSequence<VectorsType, CoeffsType, OnTheLeft> HouseholderSequenceType; - typedef typename VectorsType::StorageIndex StorageIndex; static inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k) { Index start = k+1+h.m_shift; @@ -100,7 +99,6 @@ struct hseq_side_dependent_impl<VectorsType, CoeffsType, OnTheRight> { typedef Transpose<Block<const VectorsType, 1, Dynamic> > EssentialVectorType; typedef HouseholderSequence<VectorsType, CoeffsType, OnTheRight> HouseholderSequenceType; - typedef typename VectorsType::StorageIndex StorageIndex; static inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k) { Index start = k+1+h.m_shift; @@ -131,7 +129,6 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS MaxColsAtCompileTime = internal::traits<HouseholderSequence>::MaxColsAtCompileTime }; typedef typename internal::traits<HouseholderSequence>::Scalar Scalar; - typedef typename VectorsType::StorageIndex StorageIndex; typedef HouseholderSequence< typename internal::conditional<NumTraits<Scalar>::IsComplex, diff --git a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h index c413e9e1a..6d63d45e4 100644 --- a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +++ b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h @@ -25,14 +25,14 @@ namespace internal { * \param ind The array of index for the elements in @p row * \param ncut The number of largest elements to keep **/ -template <typename VectorV, typename VectorI, typename Index> +template <typename VectorV, typename VectorI> Index QuickSplit(VectorV &row, VectorI &ind, Index ncut) { typedef typename VectorV::RealScalar RealScalar; using std::swap; using std::abs; Index mid; - Index n = convert_index<Index>(row.size()); /* length of the vector */ + Index n = row.size(); /* length of the vector */ Index first, last ; ncut--; /* to fit the zero-based indices */ @@ -124,9 +124,9 @@ class IncompleteLUT : public SparseSolverBase<IncompleteLUT<_Scalar> > compute(mat); } - StorageIndex rows() const { return m_lu.rows(); } + Index rows() const { return m_lu.rows(); } - StorageIndex cols() const { return m_lu.cols(); } + Index cols() const { return m_lu.cols(); } /** \brief Reports whether previous computation was successful. * @@ -239,9 +239,10 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) using std::sqrt; using std::swap; using std::abs; + using internal::convert_index; eigen_assert((amat.rows() == amat.cols()) && "The factorization should be done on a square matrix"); - StorageIndex n = amat.cols(); // Size of the matrix + Index n = amat.cols(); // Size of the matrix m_lu.resize(n,n); // Declare Working vectors and variables Vector u(n) ; // real values of the row -- maximum size is n -- @@ -259,36 +260,36 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) u.fill(0); // number of largest elements to keep in each row: - StorageIndex fill_in = static_cast<StorageIndex> (amat.nonZeros()*m_fillfactor)/n+1; + Index fill_in = (amat.nonZeros()*m_fillfactor)/n + 1; if (fill_in > n) fill_in = n; // number of largest nonzero elements to keep in the L and the U part of the current row: - StorageIndex nnzL = fill_in/2; - StorageIndex nnzU = nnzL; + Index nnzL = fill_in/2; + Index nnzU = nnzL; m_lu.reserve(n * (nnzL + nnzU + 1)); // global loop over the rows of the sparse matrix - for (StorageIndex ii = 0; ii < n; ii++) + for (Index ii = 0; ii < n; ii++) { // 1 - copy the lower and the upper part of the row i of mat in the working vector u - StorageIndex sizeu = 1; // number of nonzero elements in the upper part of the current row - StorageIndex sizel = 0; // number of nonzero elements in the lower part of the current row - ju(ii) = ii; + Index sizeu = 1; // number of nonzero elements in the upper part of the current row + Index sizel = 0; // number of nonzero elements in the lower part of the current row + ju(ii) = convert_index<StorageIndex>(ii); u(ii) = 0; - jr(ii) = ii; + jr(ii) = convert_index<StorageIndex>(ii); RealScalar rownorm = 0; typename FactorType::InnerIterator j_it(mat, ii); // Iterate through the current row ii for (; j_it; ++j_it) { - StorageIndex k = j_it.index(); + Index k = j_it.index(); if (k < ii) { // copy the lower part - ju(sizel) = k; + ju(sizel) = convert_index<StorageIndex>(k); u(sizel) = j_it.value(); - jr(k) = sizel; + jr(k) = convert_index<StorageIndex>(sizel); ++sizel; } else if (k == ii) @@ -298,10 +299,10 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) else { // copy the upper part - StorageIndex jpos = ii + sizeu; - ju(jpos) = k; + Index jpos = ii + sizeu; + ju(jpos) = convert_index<StorageIndex>(k); u(jpos) = j_it.value(); - jr(k) = jpos; + jr(k) = convert_index<StorageIndex>(jpos); ++sizeu; } rownorm += numext::abs2(j_it.value()); @@ -317,21 +318,22 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) rownorm = sqrt(rownorm); // 3 - eliminate the previous nonzero rows - StorageIndex jj = 0; - StorageIndex len = 0; + Index jj = 0; + Index len = 0; while (jj < sizel) { // In order to eliminate in the correct order, // we must select first the smallest column index among ju(jj:sizel) - StorageIndex k; - StorageIndex minrow = ju.segment(jj,sizel-jj).minCoeff(&k); // k is relative to the segment + Index k; + Index minrow = ju.segment(jj,sizel-jj).minCoeff(&k); // k is relative to the segment k += jj; if (minrow != ju(jj)) { // swap the two locations - StorageIndex j = ju(jj); + Index j = ju(jj); swap(ju(jj), ju(k)); - jr(minrow) = jj; jr(j) = k; + jr(minrow) = convert_index<StorageIndex>(jj); + jr(j) = convert_index<StorageIndex>(k); swap(u(jj), u(k)); } // Reset this location @@ -355,11 +357,11 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) for (; ki_it; ++ki_it) { Scalar prod = fact * ki_it.value(); - StorageIndex j = ki_it.index(); - StorageIndex jpos = jr(j); + Index j = ki_it.index(); + Index jpos = jr(j); if (jpos == -1) // fill-in element { - StorageIndex newpos; + Index newpos; if (j >= ii) // dealing with the upper part { newpos = ii + sizeu; @@ -372,23 +374,23 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) sizel++; eigen_internal_assert(sizel<=ii); } - ju(newpos) = j; + ju(newpos) = convert_index<StorageIndex>(j); u(newpos) = -prod; - jr(j) = newpos; + jr(j) = convert_index<StorageIndex>(newpos); } else u(jpos) -= prod; } // store the pivot element - u(len) = fact; - ju(len) = minrow; + u(len) = fact; + ju(len) = convert_index<StorageIndex>(minrow); ++len; jj++; } // end of the elimination on the row ii // reset the upper part of the pointer jr to zero - for(StorageIndex k = 0; k <sizeu; k++) jr(ju(ii+k)) = -1; + for(Index k = 0; k <sizeu; k++) jr(ju(ii+k)) = -1; // 4 - partially sort and insert the elements in the m_lu matrix @@ -401,7 +403,7 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) // store the largest m_fill elements of the L part m_lu.startVec(ii); - for(StorageIndex k = 0; k < len; k++) + for(Index k = 0; k < len; k++) m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k); // store the diagonal element @@ -413,7 +415,7 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) // sort the U-part of the row // apply the dropping rule first len = 0; - for(StorageIndex k = 1; k < sizeu; k++) + for(Index k = 1; k < sizeu; k++) { if(abs(u(ii+k)) > m_droptol * rownorm ) { @@ -429,7 +431,7 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat) internal::QuickSplit(uu, juu, len); // store the largest elements of the U part - for(StorageIndex k = ii + 1; k < ii + len; k++) + for(Index k = ii + 1; k < ii + len; k++) m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k); } diff --git a/Eigen/src/LU/FullPivLU.h b/Eigen/src/LU/FullPivLU.h index eb4520004..49c8b183d 100644 --- a/Eigen/src/LU/FullPivLU.h +++ b/Eigen/src/LU/FullPivLU.h @@ -66,10 +66,10 @@ template<typename _MatrixType> class FullPivLU typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; typedef typename internal::traits<MatrixType>::StorageKind StorageKind; - typedef typename MatrixType::Index Index; + // FIXME should be int typedef typename MatrixType::StorageIndex StorageIndex; - typedef typename internal::plain_row_type<MatrixType, Index>::type IntRowVectorType; - typedef typename internal::plain_col_type<MatrixType, Index>::type IntColVectorType; + typedef typename internal::plain_row_type<MatrixType, StorageIndex>::type IntRowVectorType; + typedef typename internal::plain_col_type<MatrixType, StorageIndex>::type IntColVectorType; typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationQType; typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationPType; typedef typename MatrixType::PlainObject PlainObject; diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h index 7e2c8b471..43c2a716e 100644 --- a/Eigen/src/LU/PartialPivLU.h +++ b/Eigen/src/LU/PartialPivLU.h @@ -72,7 +72,7 @@ template<typename _MatrixType> class PartialPivLU typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; typedef typename internal::traits<MatrixType>::StorageKind StorageKind; - typedef typename MatrixType::Index Index; + // FIXME should be int typedef typename MatrixType::StorageIndex StorageIndex; typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationType; typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> TranspositionType; diff --git a/Eigen/src/QR/ColPivHouseholderQR.h b/Eigen/src/QR/ColPivHouseholderQR.h index 0dee139ce..c500529da 100644 --- a/Eigen/src/QR/ColPivHouseholderQR.h +++ b/Eigen/src/QR/ColPivHouseholderQR.h @@ -57,7 +57,7 @@ template<typename _MatrixType> class ColPivHouseholderQR }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; + // FIXME should be int typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, Options, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType; typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType; diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index 90ab25b2b..a7a0d9138 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -66,11 +66,11 @@ template<typename _MatrixType> class FullPivHouseholderQR }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; + // FIXME should be int typedef typename MatrixType::StorageIndex StorageIndex; typedef internal::FullPivHouseholderQRMatrixQReturnType<MatrixType> MatrixQReturnType; typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType; - typedef Matrix<Index, 1, + typedef Matrix<StorageIndex, 1, EIGEN_SIZE_MIN_PREFER_DYNAMIC(ColsAtCompileTime,RowsAtCompileTime), RowMajor, 1, EIGEN_SIZE_MIN_PREFER_FIXED(MaxColsAtCompileTime,MaxRowsAtCompileTime)> IntDiagSizeVectorType; typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationType; diff --git a/Eigen/src/QR/HouseholderQR.h b/Eigen/src/QR/HouseholderQR.h index 5156a6e4b..8f25cf728 100644 --- a/Eigen/src/QR/HouseholderQR.h +++ b/Eigen/src/QR/HouseholderQR.h @@ -53,7 +53,7 @@ template<typename _MatrixType> class HouseholderQR }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; + // FIXME should be int typedef typename MatrixType::StorageIndex StorageIndex; typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime, (MatrixType::Flags&RowMajorBit) ? RowMajor : ColMajor, MaxRowsAtCompileTime, MaxRowsAtCompileTime> MatrixQType; typedef typename internal::plain_diag_type<MatrixType>::type HCoeffsType; diff --git a/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h b/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h index 58efa6024..4ad22f8b4 100644 --- a/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +++ b/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h @@ -236,7 +236,7 @@ class SPQR : public SparseSolverBase<SPQR<_MatrixType> > mutable cholmod_sparse *m_H; //The householder vectors mutable StorageIndex *m_HPinv; // The row permutation of H mutable cholmod_dense *m_HTau; // The Householder coefficients - mutable StorageIndex m_rank; // The rank of the matrix + mutable Index m_rank; // The rank of the matrix mutable cholmod_common m_cc; // Workspace and parameters bool m_useDefaultThreshold; // Use default threshold template<typename ,typename > friend struct SPQR_QProduct; @@ -250,8 +250,8 @@ struct SPQR_QProduct : ReturnByValue<SPQR_QProduct<SPQRType,Derived> > //Define the constructor to get reference to argument types SPQR_QProduct(const SPQRType& spqr, const Derived& other, bool transpose) : m_spqr(spqr),m_other(other),m_transpose(transpose) {} - inline StorageIndex rows() const { return m_transpose ? m_spqr.rows() : m_spqr.cols(); } - inline StorageIndex cols() const { return m_other.cols(); } + inline Index rows() const { return m_transpose ? m_spqr.rows() : m_spqr.cols(); } + inline Index cols() const { return m_other.cols(); } // Assign to a vector template<typename ResType> void evalTo(ResType& res) const diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h index 0bc2ede28..95d378da9 100644 --- a/Eigen/src/SVD/SVDBase.h +++ b/Eigen/src/SVD/SVDBase.h @@ -52,7 +52,6 @@ public: typedef typename internal::traits<Derived>::MatrixType MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; - typedef typename MatrixType::Index Index; typedef typename MatrixType::StorageIndex StorageIndex; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, diff --git a/Eigen/src/SparseCholesky/SimplicialCholesky.h b/Eigen/src/SparseCholesky/SimplicialCholesky.h index c47077e50..2580151de 100644 --- a/Eigen/src/SparseCholesky/SimplicialCholesky.h +++ b/Eigen/src/SparseCholesky/SimplicialCholesky.h @@ -92,8 +92,8 @@ class SimplicialCholeskyBase : public SparseSolverBase<Derived> Derived& derived() { return *static_cast<Derived*>(this); } const Derived& derived() const { return *static_cast<const Derived*>(this); } - inline StorageIndex cols() const { return m_matrix.cols(); } - inline StorageIndex rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + inline Index rows() const { return m_matrix.rows(); } /** \brief Reports whether previous computation was successful. * @@ -108,12 +108,12 @@ class SimplicialCholeskyBase : public SparseSolverBase<Derived> /** \returns the permutation P * \sa permutationPinv() */ - const PermutationMatrix<Dynamic,Dynamic,Index>& permutationP() const + const PermutationMatrix<Dynamic,Dynamic,StorageIndex>& permutationP() const { return m_P; } /** \returns the inverse P^-1 of the permutation P * \sa permutationP() */ - const PermutationMatrix<Dynamic,Dynamic,Index>& permutationPinv() const + const PermutationMatrix<Dynamic,Dynamic,StorageIndex>& permutationPinv() const { return m_Pinv; } /** Sets the shift parameters that will be used to adjust the diagonal coefficients during the numerical factorization. diff --git a/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h b/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h index a93189df2..9e2e878e0 100644 --- a/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +++ b/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h @@ -57,7 +57,7 @@ void SimplicialCholeskyBase<Derived>::analyzePattern_preordered(const CholMatrix ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0); - for(StorageIndex k = 0; k < size; ++k) + for(Index k = 0; k < size; ++k) { /* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */ m_parent[k] = -1; /* parent of k is not yet known */ @@ -104,7 +104,7 @@ void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); eigen_assert(ap.rows()==ap.cols()); - const StorageIndex size = ap.rows(); + const Index size = ap.rows(); eigen_assert(m_parent.size()==size); eigen_assert(m_nonZerosPerCol.size()==size); @@ -119,20 +119,20 @@ void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& bool ok = true; m_diag.resize(DoLDLT ? size : 0); - for(StorageIndex k = 0; k < size; ++k) + for(Index k = 0; k < size; ++k) { // compute nonzero pattern of kth row of L, in topological order y[k] = 0.0; // Y(0:k) is now all zero - StorageIndex top = size; // stack for pattern is empty + Index top = size; // stack for pattern is empty tags[k] = k; // mark node k as visited m_nonZerosPerCol[k] = 0; // count of nonzeros in column k of L for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it) { - StorageIndex i = it.index(); + Index i = it.index(); if(i <= k) { y[i] += numext::conj(it.value()); /* scatter A(i,k) into Y (sum duplicates) */ - StorageIndex len; + Index len; for(len = 0; tags[i] != k; i = m_parent[i]) { pattern[len++] = i; /* L(k,i) is nonzero */ @@ -149,7 +149,7 @@ void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& y[k] = 0.0; for(; top < size; ++top) { - StorageIndex i = pattern[top]; /* pattern[top:n-1] is pattern of L(:,k) */ + Index i = pattern[top]; /* pattern[top:n-1] is pattern of L(:,k) */ Scalar yi = y[i]; /* get and clear Y(i) */ y[i] = 0.0; @@ -160,8 +160,8 @@ void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& else yi = l_ki = yi / Lx[Lp[i]]; - StorageIndex p2 = Lp[i] + m_nonZerosPerCol[i]; - StorageIndex p; + Index p2 = Lp[i] + m_nonZerosPerCol[i]; + Index p; for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p) y[Li[p]] -= numext::conj(Lx[p]) * yi; d -= numext::real(l_ki * numext::conj(yi)); @@ -180,7 +180,7 @@ void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& } else { - StorageIndex p = Lp[k] + m_nonZerosPerCol[k]++; + Index p = Lp[k] + m_nonZerosPerCol[k]++; Li[p] = k ; /* store L(k,k) = sqrt (d) in column k */ if(d <= RealScalar(0)) { ok = false; /* failure, matrix is not positive definite */ diff --git a/Eigen/src/SparseCore/AmbiVector.h b/Eigen/src/SparseCore/AmbiVector.h index 8bde5d58e..1233e164e 100644 --- a/Eigen/src/SparseCore/AmbiVector.h +++ b/Eigen/src/SparseCore/AmbiVector.h @@ -36,7 +36,7 @@ class AmbiVector void init(double estimatedDensity); void init(int mode); - StorageIndex nonZeros() const; + Index nonZeros() const; /** Specifies a sub-vector to work on */ void setBounds(Index start, Index end) { m_start = convert_index(start); m_end = convert_index(end); } @@ -126,7 +126,7 @@ class AmbiVector /** \returns the number of non zeros in the current sub vector */ template<typename _Scalar,typename _StorageIndex> -_StorageIndex AmbiVector<_Scalar,_StorageIndex>::nonZeros() const +Index AmbiVector<_Scalar,_StorageIndex>::nonZeros() const { if (m_mode==IsSparse) return m_llSize; diff --git a/Eigen/src/SparseCore/CompressedStorage.h b/Eigen/src/SparseCore/CompressedStorage.h index 2d4f2bcf8..bba8a104b 100644 --- a/Eigen/src/SparseCore/CompressedStorage.h +++ b/Eigen/src/SparseCore/CompressedStorage.h @@ -36,7 +36,7 @@ class CompressedStorage : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) {} - explicit CompressedStorage(size_t size) + explicit CompressedStorage(Index size) : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0) { resize(size); @@ -70,9 +70,9 @@ class CompressedStorage delete[] m_indices; } - void reserve(size_t size) + void reserve(Index size) { - size_t newAllocatedSize = m_size + size; + Index newAllocatedSize = m_size + size; if (newAllocatedSize > m_allocatedSize) reallocate(newAllocatedSize); } @@ -83,13 +83,14 @@ class CompressedStorage reallocate(m_size); } - void resize(size_t size, double reserveSizeFactor = 0) + void resize(Index size, double reserveSizeFactor = 0) { if (m_allocatedSize<size) - reallocate(size + size_t(reserveSizeFactor*double(size))); + reallocate(size + Index(reserveSizeFactor*double(size))); m_size = size; } + // FIXME i should be a StorageIndex void append(const Scalar& v, Index i) { Index id = m_size; @@ -98,34 +99,34 @@ class CompressedStorage m_indices[id] = internal::convert_index<StorageIndex>(i); } - inline size_t size() const { return m_size; } - inline size_t allocatedSize() const { return m_allocatedSize; } + inline Index size() const { return m_size; } + inline Index allocatedSize() const { return m_allocatedSize; } inline void clear() { m_size = 0; } - inline Scalar& value(size_t i) { return m_values[i]; } - inline const Scalar& value(size_t i) const { return m_values[i]; } + inline Scalar& value(Index i) { return m_values[i]; } + inline const Scalar& value(Index i) const { return m_values[i]; } - inline StorageIndex& index(size_t i) { return m_indices[i]; } - inline const StorageIndex& index(size_t i) const { return m_indices[i]; } + inline StorageIndex& index(Index i) { return m_indices[i]; } + inline const StorageIndex& index(Index i) const { return m_indices[i]; } /** \returns the largest \c k such that for all \c j in [0,k) index[\c j]\<\a key */ - inline StorageIndex searchLowerIndex(Index key) const + inline StorageIndex searchLowerIndex(StorageIndex key) const { return searchLowerIndex(0, m_size, key); } /** \returns the largest \c k in [start,end) such that for all \c j in [start,k) index[\c j]\<\a key */ - inline StorageIndex searchLowerIndex(size_t start, size_t end, Index key) const + inline Index searchLowerIndex(Index start, Index end, StorageIndex key) const { while(end>start) { - size_t mid = (end+start)>>1; + Index mid = (end+start)>>1; if (m_indices[mid]<key) start = mid+1; else end = mid; } - return static_cast<StorageIndex>(start); + return start; } /** \returns the stored value at index \a key @@ -138,12 +139,12 @@ class CompressedStorage return m_values[m_size-1]; // ^^ optimization: let's first check if it is the last coefficient // (very common in high level algorithms) - const size_t id = searchLowerIndex(0,m_size-1,key); + const Index id = searchLowerIndex(0,m_size-1,key); return ((id<m_size) && (m_indices[id]==key)) ? m_values[id] : defaultValue; } /** Like at(), but the search is performed in the range [start,end) */ - inline Scalar atInRange(size_t start, size_t end, Index key, const Scalar &defaultValue = Scalar(0)) const + inline Scalar atInRange(Index start, Index end, Index key, const Scalar &defaultValue = Scalar(0)) const { if (start>=end) return defaultValue; @@ -151,7 +152,7 @@ class CompressedStorage return m_values[end-1]; // ^^ optimization: let's first check if it is the last coefficient // (very common in high level algorithms) - const size_t id = searchLowerIndex(start,end-1,key); + const Index id = searchLowerIndex(start,end-1,key); return ((id<end) && (m_indices[id]==key)) ? m_values[id] : defaultValue; } @@ -160,7 +161,7 @@ class CompressedStorage * such that the keys are sorted. */ inline Scalar& atWithInsertion(Index key, const Scalar& defaultValue = Scalar(0)) { - size_t id = searchLowerIndex(0,m_size,key); + Index id = searchLowerIndex(0,m_size,key); if (id>=m_size || m_indices[id]!=key) { if (m_allocatedSize<m_size+1) @@ -196,9 +197,9 @@ class CompressedStorage void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits<RealScalar>::dummy_precision()) { - size_t k = 0; - size_t n = size(); - for (size_t i=0; i<n; ++i) + Index k = 0; + Index n = size(); + for (Index i=0; i<n; ++i) { if (!internal::isMuchSmallerThan(value(i), reference, epsilon)) { @@ -212,12 +213,12 @@ class CompressedStorage protected: - inline void reallocate(size_t size) + inline void reallocate(Index size) { eigen_internal_assert(size!=m_allocatedSize); internal::scoped_array<Scalar> newValues(size); internal::scoped_array<StorageIndex> newIndices(size); - size_t copySize = (std::min)(size, m_size); + Index copySize = (std::min)(size, m_size); internal::smart_copy(m_values, m_values+copySize, newValues.ptr()); internal::smart_copy(m_indices, m_indices+copySize, newIndices.ptr()); std::swap(m_values,newValues.ptr()); @@ -228,8 +229,8 @@ class CompressedStorage protected: Scalar* m_values; StorageIndex* m_indices; - size_t m_size; - size_t m_allocatedSize; + Index m_size; + Index m_allocatedSize; }; diff --git a/Eigen/src/SparseCore/SparseBlock.h b/Eigen/src/SparseCore/SparseBlock.h index dfdf4314a..5256bf950 100644 --- a/Eigen/src/SparseCore/SparseBlock.h +++ b/Eigen/src/SparseCore/SparseBlock.h @@ -34,14 +34,14 @@ public: : m_matrix(xpr), m_outerStart(convert_index(IsRowMajor ? startRow : startCol)), m_outerSize(convert_index(IsRowMajor ? blockRows : blockCols))
{}
- EIGEN_STRONG_INLINE StorageIndex rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
- EIGEN_STRONG_INLINE StorageIndex cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
+ EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
+ EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
- StorageIndex nonZeros() const
+ Index nonZeros() const
{
typedef typename internal::evaluator<XprType>::type EvaluatorType;
EvaluatorType matEval(m_matrix);
- StorageIndex nnz = 0;
+ Index nnz = 0;
Index end = m_outerStart + m_outerSize.value();
for(Index j=m_outerStart; j<end; ++j)
for(typename EvaluatorType::InnerIterator it(matEval, j); it; ++it)
@@ -50,16 +50,16 @@ public: }
inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; }
- StorageIndex startRow() const { return IsRowMajor ? m_outerStart : 0; }
- StorageIndex startCol() const { return IsRowMajor ? 0 : m_outerStart; }
- StorageIndex blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
- StorageIndex blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
+ Index startRow() const { return IsRowMajor ? m_outerStart : 0; }
+ Index startCol() const { return IsRowMajor ? 0 : m_outerStart; }
+ Index blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
+ Index blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
protected:
typename XprType::Nested m_matrix;
- StorageIndex m_outerStart;
- const internal::variable_if_dynamic<StorageIndex, OuterSize> m_outerSize;
+ Index m_outerStart;
+ const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
public:
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
@@ -106,11 +106,11 @@ public: SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, StorageIndex> tmp(other);
// 2 - let's check whether there is enough allocated memory
- StorageIndex nnz = tmp.nonZeros();
- StorageIndex start = m_outerStart==0 ? 0 : matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block
- StorageIndex end = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()]; // ending position of the current block
- StorageIndex block_size = end - start; // available room in the current block
- StorageIndex tail_size = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end;
+ Index nnz = tmp.nonZeros();
+ Index start = m_outerStart==0 ? 0 : matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block
+ Index end = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()]; // ending position of the current block
+ Index block_size = end - start; // available room in the current block
+ Index tail_size = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end;
Index free_size = m_matrix.isCompressed()
? Index(matrix.data().allocatedSize()) + block_size
@@ -192,7 +192,7 @@ public: inline StorageIndex* innerNonZeroPtr()
{ return isCompressed() ? 0 : m_matrix.const_cast_derived().innerNonZeroPtr(); }
- StorageIndex nonZeros() const
+ Index nonZeros() const
{
if(m_matrix.isCompressed())
return ( (m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
@@ -215,20 +215,20 @@ public: return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
}
- EIGEN_STRONG_INLINE StorageIndex rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
- EIGEN_STRONG_INLINE StorageIndex cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
+ EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
+ EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; }
- StorageIndex startRow() const { return IsRowMajor ? m_outerStart : 0; }
- StorageIndex startCol() const { return IsRowMajor ? 0 : m_outerStart; }
- StorageIndex blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
- StorageIndex blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
+ Index startRow() const { return IsRowMajor ? m_outerStart : 0; }
+ Index startCol() const { return IsRowMajor ? 0 : m_outerStart; }
+ Index blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
+ Index blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
protected:
typename SparseMatrixType::Nested m_matrix;
- StorageIndex m_outerStart;
- const internal::variable_if_dynamic<StorageIndex, OuterSize> m_outerSize;
+ Index m_outerStart;
+ const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
};
@@ -353,8 +353,8 @@ public: : m_matrix(xpr), m_startRow(convert_index(startRow)), m_startCol(convert_index(startCol)), m_blockRows(convert_index(blockRows)), m_blockCols(convert_index(blockCols))
{}
- inline StorageIndex rows() const { return m_blockRows.value(); }
- inline StorageIndex cols() const { return m_blockCols.value(); }
+ inline Index rows() const { return m_blockRows.value(); }
+ inline Index cols() const { return m_blockCols.value(); }
inline Scalar& coeffRef(Index row, Index col)
{
@@ -382,10 +382,10 @@ public: }
inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; }
- StorageIndex startRow() const { return m_startRow.value(); }
- StorageIndex startCol() const { return m_startCol.value(); }
- StorageIndex blockRows() const { return m_blockRows.value(); }
- StorageIndex blockCols() const { return m_blockCols.value(); }
+ Index startRow() const { return m_startRow.value(); }
+ Index startCol() const { return m_startCol.value(); }
+ Index blockRows() const { return m_blockRows.value(); }
+ Index blockCols() const { return m_blockCols.value(); }
protected:
friend class internal::GenericSparseBlockInnerIteratorImpl<XprType,BlockRows,BlockCols,InnerPanel>;
@@ -394,10 +394,10 @@ public: EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
typename XprType::Nested m_matrix;
- const internal::variable_if_dynamic<StorageIndex, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
- const internal::variable_if_dynamic<StorageIndex, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
- const internal::variable_if_dynamic<StorageIndex, RowsAtCompileTime> m_blockRows;
- const internal::variable_if_dynamic<StorageIndex, ColsAtCompileTime> m_blockCols;
+ const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
+ const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
+ const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
+ const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
};
@@ -425,10 +425,10 @@ namespace internal { Base::operator++();
}
- inline StorageIndex index() const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
- inline StorageIndex outer() const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); }
- inline StorageIndex row() const { return Base::row() - m_block.m_startRow.value(); }
- inline StorageIndex col() const { return Base::col() - m_block.m_startCol.value(); }
+ inline Index index() const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
+ inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); }
+ inline Index row() const { return Base::row() - m_block.m_startRow.value(); }
+ inline Index col() const { return Base::col() - m_block.m_startCol.value(); }
inline operator bool() const { return Base::operator bool() && Base::index() < m_end; }
};
@@ -445,10 +445,10 @@ namespace internal { typedef typename BlockType::StorageIndex StorageIndex;
typedef typename BlockType::Scalar Scalar;
const BlockType& m_block;
- StorageIndex m_outerPos;
- StorageIndex m_innerIndex;
+ Index m_outerPos;
+ Index m_innerIndex;
Scalar m_value;
- StorageIndex m_end;
+ Index m_end;
public:
explicit EIGEN_STRONG_INLINE GenericSparseBlockInnerIteratorImpl(const BlockType& block, Index outer = 0)
@@ -464,10 +464,10 @@ namespace internal { ++(*this);
}
- inline StorageIndex index() const { return m_outerPos - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
- inline StorageIndex outer() const { return 0; }
- inline StorageIndex row() const { return IsRowMajor ? 0 : index(); }
- inline StorageIndex col() const { return IsRowMajor ? index() : 0; }
+ inline Index index() const { return m_outerPos - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
+ inline Index outer() const { return 0; }
+ inline Index row() const { return IsRowMajor ? 0 : index(); }
+ inline Index col() const { return IsRowMajor ? index() : 0; }
inline Scalar value() const { return m_value; }
@@ -546,10 +546,10 @@ public: EvalIterator::operator++();
}
- inline StorageIndex index() const { return EvalIterator::index() - (IsRowMajor ? m_block.startCol() : m_block.startRow()); }
- inline StorageIndex outer() const { return EvalIterator::outer() - (IsRowMajor ? m_block.startRow() : m_block.startCol()); }
- inline StorageIndex row() const { return EvalIterator::row() - m_block.startRow(); }
- inline StorageIndex col() const { return EvalIterator::col() - m_block.startCol(); }
+ inline Index index() const { return EvalIterator::index() - (IsRowMajor ? m_block.startCol() : m_block.startRow()); }
+ inline Index outer() const { return EvalIterator::outer() - (IsRowMajor ? m_block.startRow() : m_block.startCol()); }
+ inline Index row() const { return EvalIterator::row() - m_block.startRow(); }
+ inline Index col() const { return EvalIterator::col() - m_block.startCol(); }
inline operator bool() const { return EvalIterator::operator bool() && EvalIterator::index() < m_end; }
};
@@ -558,10 +558,10 @@ template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel> class unary_evaluator<Block<ArgType,BlockRows,BlockCols,InnerPanel>, IteratorBased>::OuterVectorInnerIterator
{
const unary_evaluator& m_eval;
- StorageIndex m_outerPos;
- StorageIndex m_innerIndex;
+ Index m_outerPos;
+ Index m_innerIndex;
Scalar m_value;
- StorageIndex m_end;
+ Index m_end;
public:
EIGEN_STRONG_INLINE OuterVectorInnerIterator(const unary_evaluator& aEval, Index outer)
@@ -576,10 +576,10 @@ public: ++(*this);
}
- inline StorageIndex index() const { return m_outerPos - (IsRowMajor ? m_eval.m_block.startCol() : m_eval.m_block.startRow()); }
- inline StorageIndex outer() const { return 0; }
- inline StorageIndex row() const { return IsRowMajor ? 0 : index(); }
- inline StorageIndex col() const { return IsRowMajor ? index() : 0; }
+ inline Index index() const { return m_outerPos - (IsRowMajor ? m_eval.m_block.startCol() : m_eval.m_block.startRow()); }
+ inline Index outer() const { return 0; }
+ inline Index row() const { return IsRowMajor ? 0 : index(); }
+ inline Index col() const { return IsRowMajor ? index() : 0; }
inline Scalar value() const { return m_value; }
diff --git a/Eigen/src/SparseCore/SparseColEtree.h b/Eigen/src/SparseCore/SparseColEtree.h index 88c799068..28fb2d175 100644 --- a/Eigen/src/SparseCore/SparseColEtree.h +++ b/Eigen/src/SparseCore/SparseColEtree.h @@ -60,7 +60,7 @@ Index etree_find (Index i, IndexVector& pp) template <typename MatrixType, typename IndexVector> int coletree(const MatrixType& mat, IndexVector& parent, IndexVector& firstRowElt, typename MatrixType::StorageIndex *perm=0) { - typedef typename MatrixType::StorageIndex Index; + typedef typename MatrixType::StorageIndex StorageIndex; Index nc = mat.cols(); // Number of columns Index m = mat.rows(); Index diagSize = (std::min)(nc,m); @@ -70,7 +70,7 @@ int coletree(const MatrixType& mat, IndexVector& parent, IndexVector& firstRowEl pp.setZero(); // Initialize disjoint sets parent.resize(mat.cols()); //Compute first nonzero column in each row - Index row,col; + StorageIndex row,col; firstRowElt.resize(m); firstRowElt.setConstant(nc); firstRowElt.segment(0, diagSize).setLinSpaced(diagSize, 0, diagSize-1); @@ -127,7 +127,7 @@ int coletree(const MatrixType& mat, IndexVector& parent, IndexVector& firstRowEl * Depth-first search from vertex n. No recursion. * This routine was contributed by Cédric Doucet, CEDRAT Group, Meylan, France. */ -template <typename Index, typename IndexVector> +template <typename IndexVector> void nr_etdfs (Index n, IndexVector& parent, IndexVector& first_kid, IndexVector& next_kid, IndexVector& post, Index postnum) { Index current = n, first, next; @@ -174,7 +174,7 @@ void nr_etdfs (Index n, IndexVector& parent, IndexVector& first_kid, IndexVector * \param parent Input tree * \param post postordered tree */ -template <typename Index, typename IndexVector> +template <typename IndexVector> void treePostorder(Index n, IndexVector& parent, IndexVector& post) { IndexVector first_kid, next_kid; // Linked list of children diff --git a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h index afb09ad91..3b4e9df59 100644 --- a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +++ b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h @@ -56,7 +56,6 @@ public: class InnerIterator { typedef typename traits<XprType>::Scalar Scalar; - typedef typename XprType::StorageIndex StorageIndex; public: @@ -97,9 +96,9 @@ public: EIGEN_STRONG_INLINE Scalar value() const { return m_value; } - EIGEN_STRONG_INLINE StorageIndex index() const { return m_id; } - EIGEN_STRONG_INLINE StorageIndex row() const { return Lhs::IsRowMajor ? m_lhsIter.row() : index(); } - EIGEN_STRONG_INLINE StorageIndex col() const { return Lhs::IsRowMajor ? index() : m_lhsIter.col(); } + EIGEN_STRONG_INLINE Index index() const { return m_id; } + EIGEN_STRONG_INLINE Index row() const { return Lhs::IsRowMajor ? m_lhsIter.row() : index(); } + EIGEN_STRONG_INLINE Index col() const { return Lhs::IsRowMajor ? index() : m_lhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return m_id>=0; } @@ -108,7 +107,7 @@ public: RhsIterator m_rhsIter; const BinaryOp& m_functor; Scalar m_value; - StorageIndex m_id; + Index m_id; }; @@ -145,7 +144,6 @@ public: class InnerIterator { typedef typename traits<XprType>::Scalar Scalar; - typedef typename XprType::StorageIndex StorageIndex; public: @@ -177,9 +175,9 @@ public: EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsIter.value(), m_rhsIter.value()); } - EIGEN_STRONG_INLINE StorageIndex index() const { return m_lhsIter.index(); } - EIGEN_STRONG_INLINE StorageIndex row() const { return m_lhsIter.row(); } - EIGEN_STRONG_INLINE StorageIndex col() const { return m_lhsIter.col(); } + EIGEN_STRONG_INLINE Index index() const { return m_lhsIter.index(); } + EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); } + EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return (m_lhsIter && m_rhsIter); } @@ -223,7 +221,6 @@ public: class InnerIterator { typedef typename traits<XprType>::Scalar Scalar; - typedef typename XprType::StorageIndex StorageIndex; enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit }; public: @@ -241,9 +238,9 @@ public: EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_lhsEval.coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); } - EIGEN_STRONG_INLINE StorageIndex index() const { return m_rhsIter.index(); } - EIGEN_STRONG_INLINE StorageIndex row() const { return m_rhsIter.row(); } - EIGEN_STRONG_INLINE StorageIndex col() const { return m_rhsIter.col(); } + EIGEN_STRONG_INLINE Index index() const { return m_rhsIter.index(); } + EIGEN_STRONG_INLINE Index row() const { return m_rhsIter.row(); } + EIGEN_STRONG_INLINE Index col() const { return m_rhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return m_rhsIter; } @@ -288,7 +285,6 @@ public: class InnerIterator { typedef typename traits<XprType>::Scalar Scalar; - typedef typename XprType::StorageIndex StorageIndex; enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit }; public: @@ -307,9 +303,9 @@ public: { return m_functor(m_lhsIter.value(), m_rhsEval.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); } - EIGEN_STRONG_INLINE StorageIndex index() const { return m_lhsIter.index(); } - EIGEN_STRONG_INLINE StorageIndex row() const { return m_lhsIter.row(); } - EIGEN_STRONG_INLINE StorageIndex col() const { return m_lhsIter.col(); } + EIGEN_STRONG_INLINE Index index() const { return m_lhsIter.index(); } + EIGEN_STRONG_INLINE Index row() const { return m_lhsIter.row(); } + EIGEN_STRONG_INLINE Index col() const { return m_lhsIter.col(); } EIGEN_STRONG_INLINE operator bool() const { return m_lhsIter; } @@ -317,7 +313,7 @@ public: LhsIterator m_lhsIter; const RhsEvaluator &m_rhsEval; const BinaryOp& m_functor; - const StorageIndex m_outer; + const Index m_outer; }; diff --git a/Eigen/src/SparseCore/SparseDenseProduct.h b/Eigen/src/SparseCore/SparseDenseProduct.h index f6e6fab29..edb9d5998 100644 --- a/Eigen/src/SparseCore/SparseDenseProduct.h +++ b/Eigen/src/SparseCore/SparseDenseProduct.h @@ -29,7 +29,6 @@ struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, t typedef typename internal::remove_all<SparseLhsType>::type Lhs; typedef typename internal::remove_all<DenseRhsType>::type Rhs; typedef typename internal::remove_all<DenseResType>::type Res; - typedef typename Lhs::StorageIndex StorageIndex; typedef typename evaluator<Lhs>::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const typename Res::Scalar& alpha) { @@ -62,7 +61,6 @@ struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, A typedef typename internal::remove_all<SparseLhsType>::type Lhs; typedef typename internal::remove_all<DenseRhsType>::type Rhs; typedef typename internal::remove_all<DenseResType>::type Res; - typedef typename Lhs::StorageIndex StorageIndex; typedef typename evaluator<Lhs>::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha) { @@ -86,7 +84,6 @@ struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, t typedef typename internal::remove_all<SparseLhsType>::type Lhs; typedef typename internal::remove_all<DenseRhsType>::type Rhs; typedef typename internal::remove_all<DenseResType>::type Res; - typedef typename Lhs::StorageIndex StorageIndex; typedef typename evaluator<Lhs>::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const typename Res::Scalar& alpha) { @@ -106,7 +103,6 @@ struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, t typedef typename internal::remove_all<SparseLhsType>::type Lhs; typedef typename internal::remove_all<DenseRhsType>::type Rhs; typedef typename internal::remove_all<DenseResType>::type Res; - typedef typename Lhs::StorageIndex StorageIndex; typedef typename evaluator<Lhs>::InnerIterator LhsInnerIterator; static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const typename Res::Scalar& alpha) { @@ -193,7 +189,6 @@ protected: typedef typename evaluator<ActualRhs>::type RhsEval; typedef typename evaluator<ActualLhs>::InnerIterator LhsIterator; typedef typename ProdXprType::Scalar Scalar; - typedef typename ProdXprType::StorageIndex StorageIndex; public: enum { @@ -211,9 +206,9 @@ public: m_factor(get(xprEval.m_rhsXprImpl, outer, typename internal::traits<ActualRhs>::StorageKind() )) {} - EIGEN_STRONG_INLINE StorageIndex outer() const { return m_outer; } - EIGEN_STRONG_INLINE StorageIndex row() const { return NeedToTranspose ? m_outer : LhsIterator::index(); } - EIGEN_STRONG_INLINE StorageIndex col() const { return NeedToTranspose ? LhsIterator::index() : m_outer; } + EIGEN_STRONG_INLINE Index outer() const { return m_outer; } + EIGEN_STRONG_INLINE Index row() const { return NeedToTranspose ? m_outer : LhsIterator::index(); } + EIGEN_STRONG_INLINE Index col() const { return NeedToTranspose ? LhsIterator::index() : m_outer; } EIGEN_STRONG_INLINE Scalar value() const { return LhsIterator::value() * m_factor; } EIGEN_STRONG_INLINE operator bool() const { return LhsIterator::operator bool() && (!m_empty); } diff --git a/Eigen/src/SparseCore/SparseDiagonalProduct.h b/Eigen/src/SparseCore/SparseDiagonalProduct.h index 19a79edad..b7598c885 100644 --- a/Eigen/src/SparseCore/SparseDiagonalProduct.h +++ b/Eigen/src/SparseCore/SparseDiagonalProduct.h @@ -66,7 +66,6 @@ struct sparse_diagonal_product_evaluator<SparseXprType, DiagonalCoeffType, SDP_A protected: typedef typename evaluator<SparseXprType>::InnerIterator SparseXprInnerIterator; typedef typename SparseXprType::Scalar Scalar; - typedef typename SparseXprType::StorageIndex StorageIndex; public: class InnerIterator : public SparseXprInnerIterator @@ -96,7 +95,6 @@ template<typename SparseXprType, typename DiagCoeffType> struct sparse_diagonal_product_evaluator<SparseXprType, DiagCoeffType, SDP_AsCwiseProduct> { typedef typename SparseXprType::Scalar Scalar; - typedef typename SparseXprType::StorageIndex StorageIndex; typedef CwiseBinaryOp<scalar_product_op<Scalar>, const typename SparseXprType::ConstInnerVectorReturnType, @@ -111,14 +109,14 @@ struct sparse_diagonal_product_evaluator<SparseXprType, DiagCoeffType, SDP_AsCwi InnerIterator(const sparse_diagonal_product_evaluator &xprEval, Index outer) : m_cwiseEval(xprEval.m_sparseXprNested.innerVector(outer).cwiseProduct(xprEval.m_diagCoeffNested)), m_cwiseIter(m_cwiseEval, 0), - m_outer(convert_index<StorageIndex>(outer)) + m_outer(outer) {} - inline Scalar value() const { return m_cwiseIter.value(); } - inline StorageIndex index() const { return convert_index<StorageIndex>(m_cwiseIter.index()); } - inline StorageIndex outer() const { return m_outer; } - inline StorageIndex col() const { return SparseXprType::IsRowMajor ? m_cwiseIter.index() : m_outer; } - inline StorageIndex row() const { return SparseXprType::IsRowMajor ? m_outer : m_cwiseIter.index(); } + inline Scalar value() const { return m_cwiseIter.value(); } + inline Index index() const { return m_cwiseIter.index(); } + inline Index outer() const { return m_outer; } + inline Index col() const { return SparseXprType::IsRowMajor ? m_cwiseIter.index() : m_outer; } + inline Index row() const { return SparseXprType::IsRowMajor ? m_outer : m_cwiseIter.index(); } EIGEN_STRONG_INLINE InnerIterator& operator++() { ++m_cwiseIter; return *this; } @@ -127,7 +125,7 @@ struct sparse_diagonal_product_evaluator<SparseXprType, DiagCoeffType, SDP_AsCwi protected: CwiseProductEval m_cwiseEval; CwiseProductIterator m_cwiseIter; - StorageIndex m_outer; + Index m_outer; }; sparse_diagonal_product_evaluator(const SparseXprType &sparseXpr, const DiagCoeffType &diagCoeff) diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index c049f9bcb..3cfd7ae9b 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -117,8 +117,8 @@ class SparseMatrix protected: typedef SparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix; - StorageIndex m_outerSize; - StorageIndex m_innerSize; + Index m_outerSize; + Index m_innerSize; StorageIndex* m_outerIndex; StorageIndex* m_innerNonZeros; // optional, if null then the data is compressed Storage m_data; @@ -129,14 +129,14 @@ class SparseMatrix public: /** \returns the number of rows of the matrix */ - inline StorageIndex rows() const { return IsRowMajor ? m_outerSize : m_innerSize; } + inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; } /** \returns the number of columns of the matrix */ - inline StorageIndex cols() const { return IsRowMajor ? m_innerSize : m_outerSize; } + inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; } /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */ - inline StorageIndex innerSize() const { return m_innerSize; } + inline Index innerSize() const { return m_innerSize; } /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */ - inline StorageIndex outerSize() const { return m_outerSize; } + inline Index outerSize() const { return m_outerSize; } /** \returns a const pointer to the array of values. * This function is aimed at interoperability with other libraries. @@ -253,7 +253,7 @@ class SparseMatrix } /** \returns the number of non zero coefficients */ - inline StorageIndex nonZeros() const + inline Index nonZeros() const { if(m_innerNonZeros) return innerNonZeros().sum(); @@ -299,7 +299,7 @@ class SparseMatrix { if(isCompressed()) { - std::size_t totalReserveSize = 0; + Index totalReserveSize = 0; // turn the matrix into non-compressed mode m_innerNonZeros = static_cast<StorageIndex*>(std::malloc(m_outerSize * sizeof(StorageIndex))); if (!m_innerNonZeros) internal::throw_std_bad_alloc(); @@ -424,7 +424,7 @@ class SparseMatrix { if(isCompressed()) { - StorageIndex size = internal::convert_index<StorageIndex>(Index(m_data.size())); + StorageIndex size = internal::convert_index<StorageIndex>(m_data.size()); Index i = m_outerSize; // find the last filled column while (i>=0 && m_outerIndex[i]==0) @@ -605,8 +605,8 @@ class SparseMatrix */ void resize(Index rows, Index cols) { - const StorageIndex outerSize = convert_index(IsRowMajor ? rows : cols); - m_innerSize = convert_index(IsRowMajor ? cols : rows); + const Index outerSize = IsRowMajor ? rows : cols; + m_innerSize = IsRowMajor ? cols : rows; m_data.clear(); if (m_outerSize != outerSize || m_outerSize==0) { @@ -1069,7 +1069,7 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& Sparse { eigen_assert(!isCompressed()); - const StorageIndex outer = convert_index(IsRowMajor ? row : col); + const Index outer = IsRowMajor ? row : col; const StorageIndex inner = convert_index(IsRowMajor ? col : row); Index room = m_outerIndex[outer+1] - m_outerIndex[outer]; diff --git a/Eigen/src/SparseCore/SparseMatrixBase.h b/Eigen/src/SparseCore/SparseMatrixBase.h index c55a6a930..9039ebcec 100644 --- a/Eigen/src/SparseCore/SparseMatrixBase.h +++ b/Eigen/src/SparseCore/SparseMatrixBase.h @@ -144,15 +144,15 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> #undef EIGEN_CURRENT_STORAGE_BASE_CLASS /** \returns the number of rows. \sa cols() */ - inline StorageIndex rows() const { return derived().rows(); } + inline Index rows() const { return derived().rows(); } /** \returns the number of columns. \sa rows() */ - inline StorageIndex cols() const { return derived().cols(); } + inline Index cols() const { return derived().cols(); } /** \returns the number of coefficients, which is \a rows()*cols(). * \sa rows(), cols(). */ - inline StorageIndex size() const { return rows() * cols(); } + inline Index size() const { return rows() * cols(); } /** \returns the number of nonzero coefficients which is in practice the number * of stored coefficients. */ - inline StorageIndex nonZeros() const { return derived().nonZeros(); } + inline Index nonZeros() const { return derived().nonZeros(); } /** \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 @@ -160,10 +160,10 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> inline bool isVector() const { return rows()==1 || cols()==1; } /** \returns the size of the storage major dimension, * i.e., the number of columns for a columns major matrix, and the number of rows otherwise */ - StorageIndex outerSize() const { return (int(Flags)&RowMajorBit) ? this->rows() : this->cols(); } + Index outerSize() const { return (int(Flags)&RowMajorBit) ? this->rows() : this->cols(); } /** \returns the size of the inner dimension according to the storage order, * i.e., the number of rows for a columns major matrix, and the number of cols otherwise */ - StorageIndex innerSize() const { return (int(Flags)&RowMajorBit) ? this->cols() : this->rows(); } + Index innerSize() const { return (int(Flags)&RowMajorBit) ? this->cols() : this->rows(); } bool isRValue() const { return m_isRValue; } Derived& markAsRValue() { m_isRValue = true; return derived(); } diff --git a/Eigen/src/SparseCore/SparseSelfAdjointView.h b/Eigen/src/SparseCore/SparseSelfAdjointView.h index e13f98144..05be8e57c 100644 --- a/Eigen/src/SparseCore/SparseSelfAdjointView.h +++ b/Eigen/src/SparseCore/SparseSelfAdjointView.h @@ -58,8 +58,8 @@ template<typename MatrixType, unsigned int _Mode> class SparseSelfAdjointView eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices"); } - inline StorageIndex rows() const { return m_matrix.rows(); } - inline StorageIndex cols() const { return m_matrix.cols(); } + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } /** \internal \returns a reference to the nested matrix */ const _MatrixTypeNested& matrix() const { return m_matrix; } @@ -530,8 +530,8 @@ class SparseSymmetricPermutationProduct : m_matrix(mat), m_perm(perm) {} - inline StorageIndex rows() const { return m_matrix.rows(); } - inline StorageIndex cols() const { return m_matrix.cols(); } + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } template<typename DestScalar, int Options, typename DstIndex> void evalTo(SparseMatrix<DestScalar,Options,DstIndex>& _dest) const diff --git a/Eigen/src/SparseCore/SparseSparseProductWithPruning.h b/Eigen/src/SparseCore/SparseSparseProductWithPruning.h index 1384fbbff..3db01bf2d 100644 --- a/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +++ b/Eigen/src/SparseCore/SparseSparseProductWithPruning.h @@ -25,8 +25,8 @@ static void sparse_sparse_product_with_pruning_impl(const Lhs& lhs, const Rhs& r typedef typename remove_all<Lhs>::type::StorageIndex StorageIndex; // make sure to call innerSize/outerSize since we fake the storage order. - StorageIndex rows = lhs.innerSize(); - StorageIndex cols = rhs.outerSize(); + Index rows = lhs.innerSize(); + Index cols = rhs.outerSize(); //Index size = lhs.outerSize(); eigen_assert(lhs.outerSize() == rhs.innerSize()); @@ -39,7 +39,7 @@ static void sparse_sparse_product_with_pruning_impl(const Lhs& lhs, const Rhs& r // the product of a rhs column with the lhs is X+Y where X is the average number of non zero // per column of the lhs. // Therefore, we have nnz(lhs*rhs) = nnz(lhs) + nnz(rhs) - StorageIndex estimated_nnz_prod = lhs.nonZeros() + rhs.nonZeros(); + Index estimated_nnz_prod = lhs.nonZeros() + rhs.nonZeros(); // mimics a resizeByInnerOuter: if(ResultType::IsRowMajor) diff --git a/Eigen/src/SparseCore/SparseTranspose.h b/Eigen/src/SparseCore/SparseTranspose.h index 84413c374..45d9c6700 100644 --- a/Eigen/src/SparseCore/SparseTranspose.h +++ b/Eigen/src/SparseCore/SparseTranspose.h @@ -48,7 +48,7 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Sparse> protected: typedef internal::SparseTransposeImpl<MatrixType> Base; public: - inline typename MatrixType::StorageIndex nonZeros() const { return Base::derived().nestedExpression().nonZeros(); } + inline Index nonZeros() const { return Base::derived().nestedExpression().nonZeros(); } }; namespace internal { @@ -61,7 +61,6 @@ struct unary_evaluator<Transpose<ArgType>, IteratorBased> typedef typename evaluator<ArgType>::ReverseInnerIterator EvalReverseIterator; public: typedef Transpose<ArgType> XprType; - typedef typename XprType::StorageIndex StorageIndex; class InnerIterator : public EvalIterator { @@ -70,8 +69,8 @@ struct unary_evaluator<Transpose<ArgType>, IteratorBased> : EvalIterator(unaryOp.m_argImpl,outer) {} - StorageIndex row() const { return EvalIterator::col(); } - StorageIndex col() const { return EvalIterator::row(); } + Index row() const { return EvalIterator::col(); } + Index col() const { return EvalIterator::row(); } }; class ReverseInnerIterator : public EvalReverseIterator @@ -81,8 +80,8 @@ struct unary_evaluator<Transpose<ArgType>, IteratorBased> : EvalReverseIterator(unaryOp.m_argImpl,outer) {} - StorageIndex row() const { return EvalReverseIterator::col(); } - StorageIndex col() const { return EvalReverseIterator::row(); } + Index row() const { return EvalReverseIterator::col(); } + Index col() const { return EvalReverseIterator::row(); } }; enum { diff --git a/Eigen/src/SparseCore/SparseTriangularView.h b/Eigen/src/SparseCore/SparseTriangularView.h index 15bdbacb5..b5fbcbdde 100644 --- a/Eigen/src/SparseCore/SparseTriangularView.h +++ b/Eigen/src/SparseCore/SparseTriangularView.h @@ -64,7 +64,6 @@ template<typename MatrixType, unsigned int Mode> class TriangularViewImpl<MatrixType,Mode,Sparse>::InnerIterator : public MatrixTypeNestedCleaned::InnerIterator { typedef typename MatrixTypeNestedCleaned::InnerIterator Base; - typedef typename TriangularViewType::StorageIndex StorageIndex; public: EIGEN_STRONG_INLINE InnerIterator(const TriangularViewImpl& view, Index outer) @@ -102,9 +101,9 @@ class TriangularViewImpl<MatrixType,Mode,Sparse>::InnerIterator : public MatrixT return *this; } - inline StorageIndex row() const { return (MatrixType::Flags&RowMajorBit ? Base::outer() : this->index()); } - inline StorageIndex col() const { return (MatrixType::Flags&RowMajorBit ? this->index() : Base::outer()); } - inline StorageIndex index() const + inline Index row() const { return (MatrixType::Flags&RowMajorBit ? Base::outer() : this->index()); } + inline Index col() const { return (MatrixType::Flags&RowMajorBit ? this->index() : Base::outer()); } + inline Index index() const { if(HasUnitDiag && m_returnOne) return Base::outer(); else return Base::index(); @@ -134,7 +133,6 @@ template<typename MatrixType, unsigned int Mode> class TriangularViewImpl<MatrixType,Mode,Sparse>::ReverseInnerIterator : public MatrixTypeNestedCleaned::ReverseInnerIterator { typedef typename MatrixTypeNestedCleaned::ReverseInnerIterator Base; - typedef typename TriangularViewImpl::StorageIndex StorageIndex; public: EIGEN_STRONG_INLINE ReverseInnerIterator(const TriangularViewType& view, Index outer) @@ -150,8 +148,8 @@ class TriangularViewImpl<MatrixType,Mode,Sparse>::ReverseInnerIterator : public EIGEN_STRONG_INLINE ReverseInnerIterator& operator--() { Base::operator--(); return *this; } - inline StorageIndex row() const { return Base::row(); } - inline StorageIndex col() const { return Base::col(); } + inline Index row() const { return Base::row(); } + inline Index col() const { return Base::col(); } EIGEN_STRONG_INLINE operator bool() const { @@ -175,7 +173,6 @@ struct unary_evaluator<TriangularView<ArgType,Mode>, IteratorBased> protected: typedef typename XprType::Scalar Scalar; - typedef typename XprType::StorageIndex StorageIndex; typedef typename evaluator<ArgType>::InnerIterator EvalIterator; enum { SkipFirst = ((Mode&Lower) && !(ArgType::Flags&RowMajorBit)) @@ -246,9 +243,9 @@ public: } } -// inline StorageIndex row() const { return (ArgType::Flags&RowMajorBit ? Base::outer() : this->index()); } -// inline StorageIndex col() const { return (ArgType::Flags&RowMajorBit ? this->index() : Base::outer()); } - inline StorageIndex index() const +// inline Index row() const { return (ArgType::Flags&RowMajorBit ? Base::outer() : this->index()); } +// inline Index col() const { return (ArgType::Flags&RowMajorBit ? this->index() : Base::outer()); } + inline Index index() const { if(HasUnitDiag && m_returnOne) return Base::outer(); else return Base::index(); diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index fd70cf2bc..b1cc4df77 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -79,10 +79,10 @@ class SparseVector Options = _Options }; - EIGEN_STRONG_INLINE StorageIndex rows() const { return IsColVector ? m_size : 1; } - EIGEN_STRONG_INLINE StorageIndex cols() const { return IsColVector ? 1 : m_size; } - EIGEN_STRONG_INLINE StorageIndex innerSize() const { return m_size; } - EIGEN_STRONG_INLINE StorageIndex outerSize() const { return 1; } + EIGEN_STRONG_INLINE Index rows() const { return IsColVector ? m_size : 1; } + EIGEN_STRONG_INLINE Index cols() const { return IsColVector ? 1 : m_size; } + EIGEN_STRONG_INLINE Index innerSize() const { return m_size; } + EIGEN_STRONG_INLINE Index outerSize() const { return 1; } EIGEN_STRONG_INLINE const Scalar* valuePtr() const { return &m_data.value(0); } EIGEN_STRONG_INLINE Scalar* valuePtr() { return &m_data.value(0); } @@ -132,7 +132,7 @@ class SparseVector inline void setZero() { m_data.clear(); } /** \returns the number of non zero coefficients */ - inline StorageIndex nonZeros() const { return static_cast<StorageIndex>(m_data.size()); } + inline Index nonZeros() const { return m_data.size(); } inline void startVec(Index outer) { @@ -213,7 +213,7 @@ class SparseVector void resize(Index newSize) { - m_size = convert_index(newSize); + m_size = newSize; m_data.clear(); } @@ -353,7 +353,7 @@ protected: } Storage m_data; - StorageIndex m_size; + Index m_size; }; template<typename Scalar, int _Options, typename _StorageIndex> @@ -361,14 +361,14 @@ class SparseVector<Scalar,_Options,_StorageIndex>::InnerIterator { public: explicit InnerIterator(const SparseVector& vec, Index outer=0) - : m_data(vec.m_data), m_id(0), m_end(convert_index(m_data.size())) + : m_data(vec.m_data), m_id(0), m_end(m_data.size()) { EIGEN_UNUSED_VARIABLE(outer); eigen_assert(outer==0); } explicit InnerIterator(const internal::CompressedStorage<Scalar,StorageIndex>& data) - : m_data(data), m_id(0), m_end(convert_index(m_data.size())) + : m_data(data), m_id(0), m_end(m_data.size()) {} inline InnerIterator& operator++() { m_id++; return *this; } @@ -376,16 +376,16 @@ class SparseVector<Scalar,_Options,_StorageIndex>::InnerIterator inline Scalar value() const { return m_data.value(m_id); } inline Scalar& valueRef() { return const_cast<Scalar&>(m_data.value(m_id)); } - inline StorageIndex index() const { return m_data.index(m_id); } - inline StorageIndex row() const { return IsColVector ? index() : 0; } - inline StorageIndex col() const { return IsColVector ? 0 : index(); } + inline Index index() const { return m_data.index(m_id); } + inline Index row() const { return IsColVector ? index() : 0; } + inline Index col() const { return IsColVector ? 0 : index(); } inline operator bool() const { return (m_id < m_end); } protected: const internal::CompressedStorage<Scalar,StorageIndex>& m_data; - StorageIndex m_id; - const StorageIndex m_end; + Index m_id; + const Index m_end; private: // If you get here, then you're not using the right InnerIterator type, e.g.: // SparseMatrix<double,RowMajor> A; @@ -398,14 +398,14 @@ class SparseVector<Scalar,_Options,_StorageIndex>::ReverseInnerIterator { public: explicit ReverseInnerIterator(const SparseVector& vec, Index outer=0) - : m_data(vec.m_data), m_id(convert_index(m_data.size())), m_start(0) + : m_data(vec.m_data), m_id(m_data.size()), m_start(0) { EIGEN_UNUSED_VARIABLE(outer); eigen_assert(outer==0); } explicit ReverseInnerIterator(const internal::CompressedStorage<Scalar,StorageIndex>& data) - : m_data(data), m_id(convert_index(m_data.size())), m_start(0) + : m_data(data), m_id(m_data.size()), m_start(0) {} inline ReverseInnerIterator& operator--() { m_id--; return *this; } @@ -413,15 +413,15 @@ class SparseVector<Scalar,_Options,_StorageIndex>::ReverseInnerIterator inline Scalar value() const { return m_data.value(m_id-1); } inline Scalar& valueRef() { return const_cast<Scalar&>(m_data.value(m_id-1)); } - inline StorageIndex index() const { return m_data.index(m_id-1); } - inline StorageIndex row() const { return IsColVector ? index() : 0; } - inline StorageIndex col() const { return IsColVector ? 0 : index(); } + inline Index index() const { return m_data.index(m_id-1); } + inline Index row() const { return IsColVector ? index() : 0; } + inline Index col() const { return IsColVector ? 0 : index(); } inline operator bool() const { return (m_id > m_start); } protected: const internal::CompressedStorage<Scalar,StorageIndex>& m_data; - StorageIndex m_id; + Index m_id; const Index m_start; }; diff --git a/Eigen/src/SparseCore/SparseView.h b/Eigen/src/SparseCore/SparseView.h index e26016c16..d6042d970 100644 --- a/Eigen/src/SparseCore/SparseView.h +++ b/Eigen/src/SparseCore/SparseView.h @@ -40,11 +40,11 @@ public: RealScalar m_epsilon = NumTraits<Scalar>::dummy_precision()) : m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {} - inline StorageIndex rows() const { return m_matrix.rows(); } - inline StorageIndex cols() const { return m_matrix.cols(); } + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } - inline StorageIndex innerSize() const { return m_matrix.innerSize(); } - inline StorageIndex outerSize() const { return m_matrix.outerSize(); } + inline Index innerSize() const { return m_matrix.innerSize(); } + inline Index outerSize() const { return m_matrix.outerSize(); } /** \returns the nested expression */ const typename internal::remove_all<MatrixTypeNested>::type& @@ -153,17 +153,17 @@ struct unary_evaluator<SparseView<ArgType>, IndexBased> : m_sve.m_argImpl.coeff(m_inner, 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 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 operator bool() const { return m_inner < m_end && m_inner>=0; } protected: const unary_evaluator &m_sve; - StorageIndex m_inner; - const StorageIndex m_outer; - const StorageIndex m_end; + Index m_inner; + const Index m_outer; + const Index m_end; private: void incrementToNonZero() diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index 380ba25c0..f60e4ac9d 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -122,8 +122,8 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >, factorize(matrix); } - inline StorageIndex rows() const { return m_mat.rows(); } - inline StorageIndex cols() const { return m_mat.cols(); } + inline Index rows() const { return m_mat.rows(); } + inline Index cols() const { return m_mat.cols(); } /** Indicate that the pattern of the input matrix is symmetric */ void isSymmetric(bool sym) { @@ -334,10 +334,10 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >, // SparseLU options bool m_symmetricmode; // values for performance - internal::perfvalues<StorageIndex> m_perfv; + internal::perfvalues m_perfv; RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot - StorageIndex m_nnzL, m_nnzU; // Nonzeros in L and U factors - StorageIndex m_detPermR; // Determinant of the coefficient matrix + Index m_nnzL, m_nnzU; // Nonzeros in L and U factors + Index m_detPermR; // Determinant of the coefficient matrix private: // Disable copy constructor SparseLU (const SparseLU& ); @@ -449,7 +449,7 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) eigen_assert(m_analysisIsOk && "analyzePattern() should be called first"); eigen_assert((matrix.rows() == matrix.cols()) && "Only for squared matrices"); - typedef typename IndexVector::Scalar Index; + typedef typename IndexVector::Scalar StorageIndex; m_isInitialized = true; @@ -461,11 +461,11 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) { m_mat.uncompress(); //NOTE: The effect of this command is only to create the InnerNonzeros pointers. //Then, permute only the column pointers - const Index * outerIndexPtr; + const StorageIndex * outerIndexPtr; if (matrix.isCompressed()) outerIndexPtr = matrix.outerIndexPtr(); else { - Index* outerIndexPtr_t = new Index[matrix.cols()+1]; + StorageIndex* outerIndexPtr_t = new StorageIndex[matrix.cols()+1]; for(Index i = 0; i <= matrix.cols(); i++) outerIndexPtr_t[i] = m_mat.outerIndexPtr()[i]; outerIndexPtr = outerIndexPtr_t; } @@ -649,12 +649,11 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) template<typename MappedSupernodalType> struct SparseLUMatrixLReturnType : internal::no_assignment_operator { - typedef typename MappedSupernodalType::StorageIndex StorageIndex; typedef typename MappedSupernodalType::Scalar Scalar; explicit SparseLUMatrixLReturnType(const MappedSupernodalType& mapL) : m_mapL(mapL) { } - StorageIndex rows() { return m_mapL.rows(); } - StorageIndex cols() { return m_mapL.cols(); } + Index rows() { return m_mapL.rows(); } + Index cols() { return m_mapL.cols(); } template<typename Dest> void solveInPlace( MatrixBase<Dest> &X) const { @@ -666,13 +665,12 @@ struct SparseLUMatrixLReturnType : internal::no_assignment_operator template<typename MatrixLType, typename MatrixUType> struct SparseLUMatrixUReturnType : internal::no_assignment_operator { - typedef typename MatrixLType::StorageIndex StorageIndex; typedef typename MatrixLType::Scalar Scalar; explicit SparseLUMatrixUReturnType(const MatrixLType& mapL, const MatrixUType& mapU) : m_mapL(mapL),m_mapU(mapU) { } - StorageIndex rows() { return m_mapL.rows(); } - StorageIndex cols() { return m_mapL.cols(); } + Index rows() { return m_mapL.rows(); } + Index cols() { return m_mapL.cols(); } template<typename Dest> void solveInPlace(MatrixBase<Dest> &X) const { diff --git a/Eigen/src/SparseLU/SparseLUImpl.h b/Eigen/src/SparseLU/SparseLUImpl.h index 14d70897d..e735fd5c8 100644 --- a/Eigen/src/SparseLU/SparseLUImpl.h +++ b/Eigen/src/SparseLU/SparseLUImpl.h @@ -16,17 +16,17 @@ namespace internal { * \class SparseLUImpl * Base class for sparseLU */ -template <typename Scalar, typename Index> +template <typename Scalar, typename StorageIndex> class SparseLUImpl { public: typedef Matrix<Scalar,Dynamic,1> ScalarVector; - typedef Matrix<Index,Dynamic,1> IndexVector; + typedef Matrix<StorageIndex,Dynamic,1> IndexVector; typedef typename ScalarVector::RealScalar RealScalar; typedef Ref<Matrix<Scalar,Dynamic,1> > BlockScalarVector; - typedef Ref<Matrix<Index,Dynamic,1> > BlockIndexVector; + typedef Ref<Matrix<StorageIndex,Dynamic,1> > BlockIndexVector; typedef LU_GlobalLU_t<IndexVector, ScalarVector> GlobalLU_t; - typedef SparseMatrix<Scalar,ColMajor,Index> MatrixType; + typedef SparseMatrix<Scalar,ColMajor,StorageIndex> MatrixType; protected: template <typename VectorType> diff --git a/Eigen/src/SparseLU/SparseLU_Memory.h b/Eigen/src/SparseLU/SparseLU_Memory.h index 1ffa7d54e..1cf8bebc7 100644 --- a/Eigen/src/SparseLU/SparseLU_Memory.h +++ b/Eigen/src/SparseLU/SparseLU_Memory.h @@ -36,13 +36,12 @@ namespace internal { enum { LUNoMarker = 3 }; enum {emptyIdxLU = -1}; -template<typename Index> inline Index LUnumTempV(Index& m, Index& w, Index& t, Index& b) { return (std::max)(m, (t+b)*w); } -template< typename Scalar, typename Index> +template< typename Scalar> inline Index LUTempSpace(Index&m, Index& w) { return (2*w + 4 + LUNoMarker) * m * sizeof(Index) + (w + 1) * m * sizeof(Scalar); @@ -59,9 +58,9 @@ inline Index LUTempSpace(Index&m, Index& w) * \param keep_prev 1: use length and do not expand the vector; 0: compute new_len and expand * \param[in,out] num_expansions Number of times the memory has been expanded */ -template <typename Scalar, typename Index> +template <typename Scalar, typename StorageIndex> template <typename VectorType> -Index SparseLUImpl<Scalar,Index>::expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions) +Index SparseLUImpl<Scalar,StorageIndex>::expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions) { float alpha = 1.5; // Ratio of the memory increase @@ -148,8 +147,8 @@ Index SparseLUImpl<Scalar,Index>::expand(VectorType& vec, Index& length, Index * \return an estimated size of the required memory if lwork = -1; otherwise, return the size of actually allocated memory when allocation failed, and 0 on success * \note Unlike SuperLU, this routine does not support successive factorization with the same pattern and the same row permutation */ -template <typename Scalar, typename Index> -Index SparseLUImpl<Scalar,Index>::memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +Index SparseLUImpl<Scalar,StorageIndex>::memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu) { Index& num_expansions = glu.num_expansions; //No memory expansions so far num_expansions = 0; @@ -205,9 +204,9 @@ Index SparseLUImpl<Scalar,Index>::memInit(Index m, Index n, Index annz, Index lw * \param num_expansions Number of expansions * \return 0 on success, > 0 size of the memory allocated so far */ -template <typename Scalar, typename Index> +template <typename Scalar, typename StorageIndex> template <typename VectorType> -Index SparseLUImpl<Scalar,Index>::memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions) +Index SparseLUImpl<Scalar,StorageIndex>::memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions) { Index failed_size; if (memtype == USUB) diff --git a/Eigen/src/SparseLU/SparseLU_Structs.h b/Eigen/src/SparseLU/SparseLU_Structs.h index 24d6bf179..cf5ec449b 100644 --- a/Eigen/src/SparseLU/SparseLU_Structs.h +++ b/Eigen/src/SparseLU/SparseLU_Structs.h @@ -75,7 +75,7 @@ typedef enum {LUSUP, UCOL, LSUB, USUB, LLVL, ULVL} MemType; template <typename IndexVector, typename ScalarVector> struct LU_GlobalLU_t { - typedef typename IndexVector::Scalar Index; + typedef typename IndexVector::Scalar StorageIndex; IndexVector xsup; //First supernode column ... xsup(s) points to the beginning of the s-th supernode IndexVector supno; // Supernode number corresponding to this column (column to supernode mapping) ScalarVector lusup; // nonzero values of L ordered by columns @@ -93,7 +93,6 @@ struct LU_GlobalLU_t { }; // Values to set for performance -template <typename Index> struct perfvalues { Index panel_size; // a panel consists of at most <panel_size> consecutive columns Index relax; // To control degree of relaxing supernodes. If the number of nodes (columns) diff --git a/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h b/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h index 098763765..f7ffc2d9c 100644 --- a/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +++ b/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h @@ -42,7 +42,7 @@ class MappedSuperNodalMatrix { } - MappedSuperNodalMatrix(StorageIndex m, StorageIndex n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind, + MappedSuperNodalMatrix(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind, IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col ) { setInfos(m, n, nzval, nzval_colptr, rowind, rowind_colptr, col_to_sup, sup_to_col); @@ -58,7 +58,7 @@ class MappedSuperNodalMatrix * FIXME This class will be modified such that it can be use in the course * of the factorization. */ - void setInfos(StorageIndex m, StorageIndex n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind, + void setInfos(Index m, Index n, ScalarVector& nzval, IndexVector& nzval_colptr, IndexVector& rowind, IndexVector& rowind_colptr, IndexVector& col_to_sup, IndexVector& sup_to_col ) { m_row = m; @@ -75,12 +75,12 @@ class MappedSuperNodalMatrix /** * Number of rows */ - StorageIndex rows() { return m_row; } + Index rows() { return m_row; } /** * Number of columns */ - StorageIndex cols() { return m_col; } + Index cols() { return m_col; } /** * Return the array of nonzero values packed by column @@ -148,7 +148,7 @@ class MappedSuperNodalMatrix /** * Return the number of supernodes */ - StorageIndex nsuper() const + Index nsuper() const { return m_nsuper; } @@ -161,9 +161,9 @@ class MappedSuperNodalMatrix protected: - StorageIndex m_row; // Number of rows - StorageIndex m_col; // Number of columns - StorageIndex m_nsuper; // Number of supernodes + Index m_row; // Number of rows + Index m_col; // Number of columns + Index m_nsuper; // Number of supernodes Scalar* m_nzval; //array of nonzero values packed by column StorageIndex* m_nzval_colptr; //nzval_colptr[j] Stores the location in nzval[] which starts column j StorageIndex* m_rowind; // Array of compressed row indices of rectangular supernodes @@ -184,7 +184,7 @@ class MappedSuperNodalMatrix<Scalar,Index>::InnerIterator public: InnerIterator(const MappedSuperNodalMatrix& mat, Eigen::Index outer) : m_matrix(mat), - m_outer(convert_index<Index>(outer)), + m_outer(outer), m_supno(mat.colToSup()[outer]), m_idval(mat.colIndexPtr()[outer]), m_startidval(m_idval), diff --git a/Eigen/src/SparseLU/SparseLU_Utils.h b/Eigen/src/SparseLU/SparseLU_Utils.h index 15352ac33..b48157d9f 100644 --- a/Eigen/src/SparseLU/SparseLU_Utils.h +++ b/Eigen/src/SparseLU/SparseLU_Utils.h @@ -17,8 +17,8 @@ namespace internal { /** * \brief Count Nonzero elements in the factors */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) { nnzL = 0; nnzU = (glu.xusub)(n); @@ -48,8 +48,8 @@ void SparseLUImpl<Scalar,Index>::countnz(const Index n, Index& nnzL, Index& nnzU * and applies permutation to the remaining subscripts * */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) { Index fsupc, i, j, k, jstart; diff --git a/Eigen/src/SparseLU/SparseLU_column_bmod.h b/Eigen/src/SparseLU/SparseLU_column_bmod.h index f24bd87d3..bda01dcb3 100644 --- a/Eigen/src/SparseLU/SparseLU_column_bmod.h +++ b/Eigen/src/SparseLU/SparseLU_column_bmod.h @@ -49,8 +49,9 @@ namespace internal { * > 0 - number of bytes allocated when run out of space * */ -template <typename Scalar, typename Index> -Index SparseLUImpl<Scalar,Index>::column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +Index SparseLUImpl<Scalar,StorageIndex>::column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, + BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu) { Index jsupno, k, ksub, krep, ksupno; Index lptr, nrow, isub, irow, nextlu, new_next, ufirst; diff --git a/Eigen/src/SparseLU/SparseLU_column_dfs.h b/Eigen/src/SparseLU/SparseLU_column_dfs.h index 4c04b0e44..17c9e6adb 100644 --- a/Eigen/src/SparseLU/SparseLU_column_dfs.h +++ b/Eigen/src/SparseLU/SparseLU_column_dfs.h @@ -30,7 +30,7 @@ #ifndef SPARSELU_COLUMN_DFS_H #define SPARSELU_COLUMN_DFS_H -template <typename Scalar, typename Index> class SparseLUImpl; +template <typename Scalar, typename StorageIndex> class SparseLUImpl; namespace Eigen { namespace internal { @@ -39,8 +39,8 @@ template<typename IndexVector, typename ScalarVector> struct column_dfs_traits : no_assignment_operator { typedef typename ScalarVector::Scalar Scalar; - typedef typename IndexVector::Scalar Index; - column_dfs_traits(Index jcol, Index& jsuper, typename SparseLUImpl<Scalar, Index>::GlobalLU_t& glu, SparseLUImpl<Scalar, Index>& luImpl) + typedef typename IndexVector::Scalar StorageIndex; + column_dfs_traits(Index jcol, Index& jsuper, typename SparseLUImpl<Scalar, StorageIndex>::GlobalLU_t& glu, SparseLUImpl<Scalar, StorageIndex>& luImpl) : m_jcol(jcol), m_jsuper_ref(jsuper), m_glu(glu), m_luImpl(luImpl) {} bool update_segrep(Index /*krep*/, Index /*jj*/) @@ -57,8 +57,8 @@ struct column_dfs_traits : no_assignment_operator Index m_jcol; Index& m_jsuper_ref; - typename SparseLUImpl<Scalar, Index>::GlobalLU_t& m_glu; - SparseLUImpl<Scalar, Index>& m_luImpl; + typename SparseLUImpl<Scalar, StorageIndex>::GlobalLU_t& m_glu; + SparseLUImpl<Scalar, StorageIndex>& m_luImpl; }; @@ -89,8 +89,10 @@ struct column_dfs_traits : no_assignment_operator * > 0 number of bytes allocated when run out of space * */ -template <typename Scalar, typename Index> -Index SparseLUImpl<Scalar,Index>::column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +Index SparseLUImpl<Scalar,StorageIndex>::column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, + BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, + IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu) { Index jsuper = glu.supno(jcol); diff --git a/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h b/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h index 170610d9f..bf237951d 100644 --- a/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +++ b/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h @@ -46,8 +46,9 @@ namespace internal { * > 0 - number of bytes allocated when run out of space * */ -template <typename Scalar, typename Index> -Index SparseLUImpl<Scalar,Index>::copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +Index SparseLUImpl<Scalar,StorageIndex>::copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, + BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu) { Index ksub, krep, ksupno; diff --git a/Eigen/src/SparseLU/SparseLU_gemm_kernel.h b/Eigen/src/SparseLU/SparseLU_gemm_kernel.h index 9e4e3e72b..7420b4d17 100644 --- a/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +++ b/Eigen/src/SparseLU/SparseLU_gemm_kernel.h @@ -21,7 +21,7 @@ namespace internal { * - lda and ldc must be multiples of the respective packet size * - C must have the same alignment as A */ -template<typename Scalar,typename Index> +template<typename Scalar> EIGEN_DONT_INLINE void sparselu_gemm(Index m, Index n, Index d, const Scalar* A, Index lda, const Scalar* B, Index ldb, Scalar* C, Index ldc) { diff --git a/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h b/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h index 7a4e4305a..4092f842f 100644 --- a/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +++ b/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h @@ -42,8 +42,8 @@ namespace internal { * \param descendants Number of descendants of each node in the etree * \param relax_end last column in a supernode */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) { // The etree may not be postordered, but its heap ordered @@ -75,7 +75,7 @@ void SparseLUImpl<Scalar,Index>::heap_relax_snode (const Index n, IndexVector& e } // Identify the relaxed supernodes by postorder traversal of the etree Index snode_start; // beginning of a snode - Index k; + StorageIndex k; Index nsuper_et_post = 0; // Number of relaxed snodes in postordered etree Index nsuper_et = 0; // Number of relaxed snodes in the original etree Index l; diff --git a/Eigen/src/SparseLU/SparseLU_kernel_bmod.h b/Eigen/src/SparseLU/SparseLU_kernel_bmod.h index cad149ded..9513f8369 100644 --- a/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +++ b/Eigen/src/SparseLU/SparseLU_kernel_bmod.h @@ -30,13 +30,13 @@ namespace internal { */ template <int SegSizeAtCompileTime> struct LU_kernel_bmod { - template <typename BlockScalarVector, typename ScalarVector, typename IndexVector, typename Index> + template <typename BlockScalarVector, typename ScalarVector, typename IndexVector> static EIGEN_DONT_INLINE void run(const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros); }; template <int SegSizeAtCompileTime> -template <typename BlockScalarVector, typename ScalarVector, typename IndexVector, typename Index> +template <typename BlockScalarVector, typename ScalarVector, typename IndexVector> EIGEN_DONT_INLINE void LU_kernel_bmod<SegSizeAtCompileTime>::run(const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros) { @@ -91,21 +91,22 @@ EIGEN_DONT_INLINE void LU_kernel_bmod<SegSizeAtCompileTime>::run(const Index seg template <> struct LU_kernel_bmod<1> { - template <typename BlockScalarVector, typename ScalarVector, typename IndexVector, typename Index> + template <typename BlockScalarVector, typename ScalarVector, typename IndexVector> static EIGEN_DONT_INLINE void run(const Index /*segsize*/, BlockScalarVector& dense, ScalarVector& /*tempv*/, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros); }; -template <typename BlockScalarVector, typename ScalarVector, typename IndexVector, typename Index> +template <typename BlockScalarVector, typename ScalarVector, typename IndexVector> EIGEN_DONT_INLINE void LU_kernel_bmod<1>::run(const Index /*segsize*/, BlockScalarVector& dense, ScalarVector& /*tempv*/, ScalarVector& lusup, Index& luptr, const Index lda, const Index nrow, IndexVector& lsub, const Index lptr, const Index no_zeros) { typedef typename ScalarVector::Scalar Scalar; + typedef typename IndexVector::Scalar StorageIndex; Scalar f = dense(lsub(lptr + no_zeros)); luptr += lda * no_zeros + no_zeros + 1; const Scalar* a(lusup.data() + luptr); - const /*typename IndexVector::Scalar*/Index* irow(lsub.data()+lptr + no_zeros + 1); + const StorageIndex* irow(lsub.data()+lptr + no_zeros + 1); Index i = 0; for (; i+1 < nrow; i+=2) { diff --git a/Eigen/src/SparseLU/SparseLU_panel_bmod.h b/Eigen/src/SparseLU/SparseLU_panel_bmod.h index da0e0fc3c..bd3cf87b9 100644 --- a/Eigen/src/SparseLU/SparseLU_panel_bmod.h +++ b/Eigen/src/SparseLU/SparseLU_panel_bmod.h @@ -52,8 +52,8 @@ namespace internal { * * */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::panel_bmod(const Index m, const Index w, const Index jcol, +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::panel_bmod(const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu) { diff --git a/Eigen/src/SparseLU/SparseLU_panel_dfs.h b/Eigen/src/SparseLU/SparseLU_panel_dfs.h index dc0054efd..f4a908ee5 100644 --- a/Eigen/src/SparseLU/SparseLU_panel_dfs.h +++ b/Eigen/src/SparseLU/SparseLU_panel_dfs.h @@ -37,8 +37,8 @@ namespace internal { template<typename IndexVector> struct panel_dfs_traits { - typedef typename IndexVector::Scalar Index; - panel_dfs_traits(Index jcol, Index* marker) + typedef typename IndexVector::Scalar StorageIndex; + panel_dfs_traits(Index jcol, StorageIndex* marker) : m_jcol(jcol), m_marker(marker) {} bool update_segrep(Index krep, Index jj) @@ -53,13 +53,13 @@ struct panel_dfs_traits void mem_expand(IndexVector& /*glu.lsub*/, Index /*nextl*/, Index /*chmark*/) {} enum { ExpandMem = false }; Index m_jcol; - Index* m_marker; + StorageIndex* m_marker; }; -template <typename Scalar, typename Index> +template <typename Scalar, typename StorageIndex> template <typename Traits> -void SparseLUImpl<Scalar,Index>::dfs_kernel(const Index jj, IndexVector& perm_r, +void SparseLUImpl<Scalar,StorageIndex>::dfs_kernel(const Index jj, IndexVector& perm_r, Index& nseg, IndexVector& panel_lsub, IndexVector& segrep, Ref<IndexVector> repfnz_col, IndexVector& xprune, Ref<IndexVector> marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu, @@ -215,8 +215,8 @@ void SparseLUImpl<Scalar,Index>::dfs_kernel(const Index jj, IndexVector& perm_r, * */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu) { Index nextl_col; // Next available position in panel_lsub[*,jj] diff --git a/Eigen/src/SparseLU/SparseLU_pivotL.h b/Eigen/src/SparseLU/SparseLU_pivotL.h index 457789c78..01f5ba4e9 100644 --- a/Eigen/src/SparseLU/SparseLU_pivotL.h +++ b/Eigen/src/SparseLU/SparseLU_pivotL.h @@ -56,8 +56,8 @@ namespace internal { * \return 0 if success, i > 0 if U(i,i) is exactly zero * */ -template <typename Scalar, typename Index> -Index SparseLUImpl<Scalar,Index>::pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +Index SparseLUImpl<Scalar,StorageIndex>::pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu) { Index fsupc = (glu.xsup)((glu.supno)(jcol)); // First column in the supernode containing the column jcol @@ -67,7 +67,7 @@ Index SparseLUImpl<Scalar,Index>::pivotL(const Index jcol, const RealScalar& dia Index lda = glu.xlusup(fsupc+1) - glu.xlusup(fsupc); // leading dimension Scalar* lu_sup_ptr = &(glu.lusup.data()[glu.xlusup(fsupc)]); // Start of the current supernode Scalar* lu_col_ptr = &(glu.lusup.data()[glu.xlusup(jcol)]); // Start of jcol in the supernode - Index* lsub_ptr = &(glu.lsub.data()[lptr]); // Start of row indices of the supernode + StorageIndex* lsub_ptr = &(glu.lsub.data()[lptr]); // Start of row indices of the supernode // Determine the largest abs numerical value for partial pivoting Index diagind = iperm_c(jcol); // diagonal index diff --git a/Eigen/src/SparseLU/SparseLU_pruneL.h b/Eigen/src/SparseLU/SparseLU_pruneL.h index 66460d168..13133fcc2 100644 --- a/Eigen/src/SparseLU/SparseLU_pruneL.h +++ b/Eigen/src/SparseLU/SparseLU_pruneL.h @@ -49,8 +49,9 @@ namespace internal { * \param glu Global LU data * */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu) +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, + const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu) { // For each supernode-rep irep in U(*,j] Index jsupno = glu.supno(jcol); diff --git a/Eigen/src/SparseLU/SparseLU_relax_snode.h b/Eigen/src/SparseLU/SparseLU_relax_snode.h index 58ec32e27..21c182d56 100644 --- a/Eigen/src/SparseLU/SparseLU_relax_snode.h +++ b/Eigen/src/SparseLU/SparseLU_relax_snode.h @@ -43,8 +43,8 @@ namespace internal { * \param descendants Number of descendants of each node in the etree * \param relax_end last column in a supernode */ -template <typename Scalar, typename Index> -void SparseLUImpl<Scalar,Index>::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) +template <typename Scalar, typename StorageIndex> +void SparseLUImpl<Scalar,StorageIndex>::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) { // compute the number of descendants of each node in the etree diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 58bfc1cb4..920b884e5 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -109,11 +109,11 @@ class SparseQR : public SparseSolverBase<SparseQR<_MatrixType,_OrderingType> > /** \returns the number of rows of the represented matrix. */ - inline StorageIndex rows() const { return m_pmat.rows(); } + inline Index rows() const { return m_pmat.rows(); } /** \returns the number of columns of the represented matrix. */ - inline StorageIndex cols() const { return m_pmat.cols();} + inline Index cols() const { return m_pmat.cols();} /** \returns a const reference to the \b sparse upper triangular matrix R of the QR factorization. */ @@ -123,7 +123,7 @@ class SparseQR : public SparseSolverBase<SparseQR<_MatrixType,_OrderingType> > * * \sa setPivotThreshold() */ - StorageIndex rank() const + Index rank() const { eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); return m_nonzeropivots; @@ -260,7 +260,7 @@ class SparseQR : public SparseSolverBase<SparseQR<_MatrixType,_OrderingType> > PermutationType m_outputPerm_c; // The final column permutation RealScalar m_threshold; // Threshold to determine null Householder reflections bool m_useDefaultThreshold; // Use default threshold - StorageIndex m_nonzeropivots; // Number of non zero pivots found + Index m_nonzeropivots; // Number of non zero pivots found IndexVector m_etree; // Column elimination tree IndexVector m_firstRowElt; // First element in each row bool m_isQSorted; // whether Q is sorted or not @@ -289,9 +289,9 @@ void SparseQR<MatrixType,OrderingType>::analyzePattern(const MatrixType& mat) // Compute the column fill reducing ordering OrderingType ord; ord(matCpy, m_perm_c); - StorageIndex n = mat.cols(); - StorageIndex m = mat.rows(); - StorageIndex diagSize = (std::min)(m,n); + Index n = mat.cols(); + Index m = mat.rows(); + Index diagSize = (std::min)(m,n); if (!m_perm_c.size()) { @@ -327,9 +327,9 @@ void SparseQR<MatrixType,OrderingType>::factorize(const MatrixType& mat) using std::abs; eigen_assert(m_analysisIsok && "analyzePattern() should be called before this step"); - Index m = mat.rows(); - Index n = mat.cols(); - Index diagSize = (std::min)(m,n); + StorageIndex m = mat.rows(); + StorageIndex n = mat.cols(); + StorageIndex diagSize = (std::min)(m,n); IndexVector mark((std::max)(m,n)); mark.setConstant(-1); // Record the visited nodes IndexVector Ridx(n), Qidx(m); // Store temporarily the row indexes for the current column of R and Q Index nzcolR, nzcolQ; // Number of nonzero for the current column of R and Q @@ -578,7 +578,6 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived { typedef typename SparseQRType::QRMatrixType MatrixType; typedef typename SparseQRType::Scalar Scalar; - typedef typename SparseQRType::StorageIndex StorageIndex; // Get the references SparseQR_QProduct(const SparseQRType& qr, const Derived& other, bool transpose) : m_qr(qr),m_other(other),m_transpose(transpose) {} @@ -634,7 +633,6 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived template<typename SparseQRType> struct SparseQRMatrixQReturnType : public EigenBase<SparseQRMatrixQReturnType<SparseQRType> > { - typedef typename SparseQRType::StorageIndex StorageIndex; typedef typename SparseQRType::Scalar Scalar; typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix; explicit SparseQRMatrixQReturnType(const SparseQRType& qr) : m_qr(qr) {} @@ -647,8 +645,8 @@ struct SparseQRMatrixQReturnType : public EigenBase<SparseQRMatrixQReturnType<Sp { return SparseQRMatrixQTransposeReturnType<SparseQRType>(m_qr); } - inline StorageIndex rows() const { return m_qr.rows(); } - inline StorageIndex cols() const { return (std::min)(m_qr.rows(),m_qr.cols()); } + inline Index rows() const { return m_qr.rows(); } + inline Index cols() const { return (std::min)(m_qr.rows(),m_qr.cols()); } // To use for operations with the transpose of Q SparseQRMatrixQTransposeReturnType<SparseQRType> transpose() const { diff --git a/Eigen/src/SuperLUSupport/SuperLUSupport.h b/Eigen/src/SuperLUSupport/SuperLUSupport.h index 3a9b5fd74..8779eb74c 100644 --- a/Eigen/src/SuperLUSupport/SuperLUSupport.h +++ b/Eigen/src/SuperLUSupport/SuperLUSupport.h @@ -313,8 +313,8 @@ class SuperLUBase : public SparseSolverBase<Derived> clearFactors(); } - inline StorageIndex rows() const { return m_matrix.rows(); } - inline StorageIndex cols() const { return m_matrix.cols(); } + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } /** \returns a reference to the Super LU option object to configure the Super LU algorithms. */ inline superlu_options_t& options() { return m_sluOptions; } @@ -616,7 +616,7 @@ void SuperLU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()"); - const StorageIndex size = m_matrix.rows(); + const Index size = m_matrix.rows(); const Index rhsCols = b.cols(); eigen_assert(size==b.rows()); diff --git a/Eigen/src/UmfPackSupport/UmfPackSupport.h b/Eigen/src/UmfPackSupport/UmfPackSupport.h index 47e8b6304..dcbd4ab71 100644 --- a/Eigen/src/UmfPackSupport/UmfPackSupport.h +++ b/Eigen/src/UmfPackSupport/UmfPackSupport.h @@ -164,8 +164,8 @@ class UmfPackLU : public SparseSolverBase<UmfPackLU<_MatrixType> > if(m_numeric) umfpack_free_numeric(&m_numeric,Scalar()); } - inline StorageIndex rows() const { return m_copyMatrix.rows(); } - inline StorageIndex cols() const { return m_copyMatrix.cols(); } + inline Index rows() const { return m_copyMatrix.rows(); } + inline Index cols() const { return m_copyMatrix.cols(); } /** \brief Reports whether previous computation was successful. * |