Bugzilla – Attachment 474 Details for
Bug 397
Implicit conversion loses integer precision: 'Index' (aka 'long') to 'int' when using Clang in Block.h
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
[patch]
fixes for tricky long to int conversions
long2int_conversions.diff (text/plain), 43.92 KB, created by
Gael Guennebaud
on 2014-07-08 17:18:10 UTC
(
hide
)
Description:
fixes for tricky long to int conversions
Filename:
MIME Type:
Creator:
Gael Guennebaud
Created:
2014-07-08 17:18:10 UTC
Size:
43.92 KB
patch
obsolete
>diff --git a/CMakeLists.txt b/CMakeLists.txt >--- a/CMakeLists.txt >+++ b/CMakeLists.txt >@@ -103,17 +103,18 @@ option(EIGEN_SPLIT_LARGE_TESTS "Split la > option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF) > if(EIGEN_DEFAULT_TO_ROW_MAJOR) > add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR") > endif() > > set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320") > > macro(ei_add_cxx_compiler_flag FLAG) >- string(REGEX REPLACE "-" "" SFLAG ${FLAG}) >+ string(REGEX REPLACE "-" "" SFLAG1 ${FLAG}) >+ string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1}) > check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) > if(COMPILER_SUPPORT_${SFLAG}) > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") > endif() > endmacro(ei_add_cxx_compiler_flag) > > if(NOT MSVC) > # We assume that other compilers are partly compatible with GNUCC >@@ -137,27 +138,31 @@ if(NOT MSVC) > ei_add_cxx_compiler_flag("-Wundef") > ei_add_cxx_compiler_flag("-Wcast-align") > ei_add_cxx_compiler_flag("-Wchar-subscripts") > ei_add_cxx_compiler_flag("-Wnon-virtual-dtor") > ei_add_cxx_compiler_flag("-Wunused-local-typedefs") > ei_add_cxx_compiler_flag("-Wpointer-arith") > ei_add_cxx_compiler_flag("-Wwrite-strings") > ei_add_cxx_compiler_flag("-Wformat-security") >+ ei_add_cxx_compiler_flag("-Wshorten-64-to-32") >+ ei_add_cxx_compiler_flag("-Wenum-conversion") >+ ei_add_cxx_compiler_flag("-Wc++11-extensions") > > ei_add_cxx_compiler_flag("-Wno-psabi") > ei_add_cxx_compiler_flag("-Wno-variadic-macros") > ei_add_cxx_compiler_flag("-Wno-long-long") > > ei_add_cxx_compiler_flag("-fno-check-new") > ei_add_cxx_compiler_flag("-fno-common") > ei_add_cxx_compiler_flag("-fstrict-aliasing") > ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark > ei_add_cxx_compiler_flag("-wd2304") # disbale ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor > >+ > # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails > # Moreover we should not set both -strict-ansi and -ansi > check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI) > ei_add_cxx_compiler_flag("-Qunused-arguments") # disable clang warning: argument unused during compilation: '-ansi' > > if(COMPILER_SUPPORT_STRICTANSI) > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi") > else() >diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h >--- a/Eigen/src/Cholesky/LDLT.h >+++ b/Eigen/src/Cholesky/LDLT.h >@@ -241,16 +241,17 @@ template<> struct ldlt_inplace<Lower> > { > template<typename MatrixType, typename TranspositionType, typename Workspace> > static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) > { > using std::abs; > typedef typename MatrixType::Scalar Scalar; > typedef typename MatrixType::RealScalar RealScalar; > typedef typename MatrixType::Index Index; >+ typedef typename TranspositionType::IndexType IndexType; > eigen_assert(mat.rows()==mat.cols()); > const Index size = mat.rows(); > > if (size <= 1) > { > transpositions.setIdentity(); > if (numext::real(mat.coeff(0,0)) > 0) sign = PositiveSemiDef; > else if (numext::real(mat.coeff(0,0)) < 0) sign = NegativeSemiDef; >@@ -260,26 +261,26 @@ template<> struct ldlt_inplace<Lower> > > for (Index k = 0; k < size; ++k) > { > // Find largest diagonal element > Index index_of_biggest_in_corner; > mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); > index_of_biggest_in_corner += k; > >- transpositions.coeffRef(k) = index_of_biggest_in_corner; >+ transpositions.coeffRef(k) = IndexType(index_of_biggest_in_corner); > if(k != index_of_biggest_in_corner) > { > // apply the transposition while taking care to consider only > // the lower triangular part > Index s = size-index_of_biggest_in_corner-1; // trailing size after the biggest element > mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); > mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); > std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); >- for(int i=k+1;i<index_of_biggest_in_corner;++i) >+ for(Index i=k+1;i<index_of_biggest_in_corner;++i) > { > Scalar tmp = mat.coeffRef(i,k); > mat.coeffRef(i,k) = numext::conj(mat.coeffRef(index_of_biggest_in_corner,i)); > mat.coeffRef(index_of_biggest_in_corner,i) = numext::conj(tmp); > } > if(NumTraits<Scalar>::IsComplex) > mat.coeffRef(index_of_biggest_in_corner,k) = numext::conj(mat.coeff(index_of_biggest_in_corner,k)); > } >@@ -437,28 +438,29 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType, > * \param w a vector to be incorporated into the decomposition. > * \param sigma a scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1. > * \sa setZero() > */ > template<typename MatrixType, int _UpLo> > template<typename Derived> > LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename NumTraits<typename MatrixType::Scalar>::Real& sigma) > { >+ typedef typename TranspositionType::IndexType IndexType; > const Index size = w.rows(); > if (m_isInitialized) > { > eigen_assert(m_matrix.rows()==size); > } > else > { > m_matrix.resize(size,size); > m_matrix.setZero(); > m_transpositions.resize(size); > for (Index i = 0; i < size; i++) >- m_transpositions.coeffRef(i) = i; >+ m_transpositions.coeffRef(i) = IndexType(i); > m_temporary.resize(size); > m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef; > m_isInitialized = true; > } > > internal::ldlt_inplace<UpLo>::update(m_matrix, m_transpositions, m_temporary, w, sigma); > > return *this; >diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h >--- a/Eigen/src/Core/PermutationMatrix.h >+++ b/Eigen/src/Core/PermutationMatrix.h >@@ -61,21 +61,21 @@ class PermutationBase : public EigenBase > enum { > Flags = Traits::Flags, > CoeffReadCost = Traits::CoeffReadCost, > RowsAtCompileTime = Traits::RowsAtCompileTime, > ColsAtCompileTime = Traits::ColsAtCompileTime, > MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, > MaxColsAtCompileTime = Traits::MaxColsAtCompileTime > }; >- typedef typename Traits::Scalar Scalar; >+ typedef typename Traits::IndexType IndexType; > typedef typename Traits::Index Index; >- typedef Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime,0,MaxRowsAtCompileTime,MaxColsAtCompileTime> >+ typedef Matrix<IndexType,RowsAtCompileTime,ColsAtCompileTime,0,MaxRowsAtCompileTime,MaxColsAtCompileTime> > DenseMatrixType; >- typedef PermutationMatrix<IndicesType::SizeAtCompileTime,IndicesType::MaxSizeAtCompileTime,Index> >+ typedef PermutationMatrix<IndicesType::SizeAtCompileTime,IndicesType::MaxSizeAtCompileTime,IndexType> > PlainPermutationType; > using Base::derived; > #endif > > /** Copies the other permutation into *this */ > template<typename OtherDerived> > Derived& operator=(const PermutationBase<OtherDerived>& other) > { >@@ -142,17 +142,17 @@ class PermutationBase : public EigenBase > inline void resize(Index newSize) > { > indices().resize(newSize); > } > > /** Sets *this to be the identity permutation matrix */ > void setIdentity() > { >- for(Index i = 0; i < size(); ++i) >+ for(IndexType i = 0; i < size(); ++i) > indices().coeffRef(i) = i; > } > > /** Sets *this to be the identity permutation matrix of given size. > */ > void setIdentity(Index newSize) > { > resize(newSize); >@@ -168,18 +168,18 @@ class PermutationBase : public EigenBase > * > * \sa applyTranspositionOnTheRight(int,int) > */ > Derived& applyTranspositionOnTheLeft(Index i, Index j) > { > 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) = j; >- else if(indices().coeff(k) == j) indices().coeffRef(k) = i; >+ if(indices().coeff(k) == i) indices().coeffRef(k) = IndexType(j); >+ else if(indices().coeff(k) == j) indices().coeffRef(k) = IndexType(i); > } > return derived(); > } > > /** Multiplies *this by the transposition \f$(ij)\f$ on the right. > * > * \returns a reference to *this. > * >@@ -265,42 +265,45 @@ class PermutationBase : public EigenBase > * \param IndexType the interger type of the indices > * > * This class represents a permutation matrix, internally stored as a vector of integers. > * > * \sa class PermutationBase, class PermutationWrapper, class DiagonalMatrix > */ > > namespace internal { >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType> >-struct traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType> > >- : traits<Matrix<IndexType,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType> >+struct traits<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _IndexType> > >+ : traits<Matrix<_IndexType,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > > { >- typedef IndexType Index; >- typedef Matrix<IndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; >+ typedef Matrix<_IndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; >+ typedef typename IndicesType::Index Index; >+ typedef _IndexType IndexType; > }; > } > >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType> >-class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType> >+class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _IndexType> > > { > typedef PermutationBase<PermutationMatrix> Base; > typedef internal::traits<PermutationMatrix> Traits; > public: > > #ifndef EIGEN_PARSED_BY_DOXYGEN > typedef typename Traits::IndicesType IndicesType; >+ typedef typename Traits::IndexType IndexType; >+ typedef typename Traits::Index Index; > #endif > > inline PermutationMatrix() > {} > > /** Constructs an uninitialized permutation matrix of given size. > */ >- inline PermutationMatrix(int size) : m_indices(size) >+ inline PermutationMatrix(Index size) : m_indices(size) > {} > > /** Copy constructor. */ > template<typename OtherDerived> > inline PermutationMatrix(const PermutationBase<OtherDerived>& other) > : m_indices(other.indices()) {} > > #ifndef EIGEN_PARSED_BY_DOXYGEN >@@ -379,43 +382,45 @@ class PermutationMatrix : public Permuta > > protected: > > IndicesType m_indices; > }; > > > namespace internal { >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType, int _PacketAccess> >-struct traits<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>,_PacketAccess> > >- : traits<Matrix<IndexType,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType, int _PacketAccess> >+struct traits<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _IndexType>,_PacketAccess> > >+ : traits<Matrix<_IndexType,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> > > { >- typedef IndexType Index; >- typedef Map<const Matrix<IndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>, _PacketAccess> IndicesType; >+ typedef Map<const Matrix<_IndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1>, _PacketAccess> IndicesType; >+ typedef typename IndicesType::Index Index; >+ typedef _IndexType IndexType; > }; > } > >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType, int _PacketAccess> >-class Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>,_PacketAccess> >- : public PermutationBase<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, IndexType>,_PacketAccess> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType, int _PacketAccess> >+class Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _IndexType>,_PacketAccess> >+ : public PermutationBase<Map<PermutationMatrix<SizeAtCompileTime, MaxSizeAtCompileTime, _IndexType>,_PacketAccess> > > { > typedef PermutationBase<Map> Base; > typedef internal::traits<Map> Traits; > public: > > #ifndef EIGEN_PARSED_BY_DOXYGEN > typedef typename Traits::IndicesType IndicesType; >- typedef typename IndicesType::Scalar Index; >+ typedef typename IndicesType::Scalar IndexType; >+ typedef typename IndicesType::Index Index; > #endif > >- inline Map(const Index* indicesPtr) >+ inline Map(const IndexType* indicesPtr) > : m_indices(indicesPtr) > {} > >- inline Map(const Index* indicesPtr, Index size) >+ inline Map(const IndexType* indicesPtr, Index size) > : m_indices(indicesPtr,size) > {} > > /** Copies the other permutation into *this */ > template<typename Other> > Map& operator=(const PermutationBase<Other>& other) > { return Base::operator=(other.derived()); } > >@@ -461,17 +466,18 @@ struct PermutationStorage {}; > > template<typename _IndicesType> class TranspositionsWrapper; > namespace internal { > template<typename _IndicesType> > struct traits<PermutationWrapper<_IndicesType> > > { > typedef PermutationStorage StorageKind; > typedef typename _IndicesType::Scalar Scalar; >- typedef typename _IndicesType::Scalar Index; >+ typedef typename _IndicesType::Scalar IndexType; >+ typedef typename _IndicesType::Index Index; > typedef _IndicesType IndicesType; > enum { > RowsAtCompileTime = _IndicesType::SizeAtCompileTime, > ColsAtCompileTime = _IndicesType::SizeAtCompileTime, > MaxRowsAtCompileTime = IndicesType::MaxRowsAtCompileTime, > MaxColsAtCompileTime = IndicesType::MaxColsAtCompileTime, > Flags = 0, > CoeffReadCost = _IndicesType::CoeffReadCost >diff --git a/Eigen/src/Core/Transpositions.h b/Eigen/src/Core/Transpositions.h >--- a/Eigen/src/Core/Transpositions.h >+++ b/Eigen/src/Core/Transpositions.h >@@ -48,17 +48,18 @@ template<typename TranspositionType, typ > template<typename Derived> > class TranspositionsBase > { > typedef internal::traits<Derived> Traits; > > public: > > typedef typename Traits::IndicesType IndicesType; >- typedef typename IndicesType::Scalar Index; >+ typedef typename IndicesType::Scalar IndexType; >+ typedef typename IndicesType::Index Index; > > Derived& derived() { return *static_cast<Derived*>(this); } > const Derived& derived() const { return *static_cast<const Derived*>(this); } > > /** Copies the \a other transpositions into \c *this */ > template<typename OtherDerived> > Derived& operator=(const TranspositionsBase<OtherDerived>& other) > { >@@ -76,43 +77,43 @@ class TranspositionsBase > return derived(); > } > #endif > > /** \returns the number of transpositions */ > inline Index size() const { return indices().size(); } > > /** Direct access to the underlying index vector */ >- inline const Index& coeff(Index i) const { return indices().coeff(i); } >+ inline const IndexType& coeff(Index i) const { return indices().coeff(i); } > /** Direct access to the underlying index vector */ >- inline Index& coeffRef(Index i) { return indices().coeffRef(i); } >+ inline IndexType& coeffRef(Index i) { return indices().coeffRef(i); } > /** Direct access to the underlying index vector */ >- inline const Index& operator()(Index i) const { return indices()(i); } >+ inline const IndexType& operator()(Index i) const { return indices()(i); } > /** Direct access to the underlying index vector */ >- inline Index& operator()(Index i) { return indices()(i); } >+ inline IndexType& operator()(Index i) { return indices()(i); } > /** Direct access to the underlying index vector */ >- inline const Index& operator[](Index i) const { return indices()(i); } >+ inline const IndexType& operator[](Index i) const { return indices()(i); } > /** Direct access to the underlying index vector */ >- inline Index& operator[](Index i) { return indices()(i); } >+ inline IndexType& operator[](Index i) { return indices()(i); } > > /** const version of indices(). */ > const IndicesType& indices() const { return derived().indices(); } > /** \returns a reference to the stored array representing the transpositions. */ > IndicesType& indices() { return derived().indices(); } > > /** Resizes to given size. */ >- inline void resize(int newSize) >+ inline void resize(Index newSize) > { > indices().resize(newSize); > } > > /** Sets \c *this to represents an identity transformation */ > void setIdentity() > { >- for(int i = 0; i < indices().size(); ++i) >+ for(IndexType i = 0; i < indices().size(); ++i) > coeffRef(i) = i; > } > > // FIXME: do we want such methods ? > // might be usefull when the target matrix expression is complex, e.g.: > // object.matrix().block(..,..,..,..) = trans * object.matrix().block(..,..,..,..); > /* > template<typename MatrixType> >@@ -139,33 +140,36 @@ class TranspositionsBase > /** \returns the tranpose transformation */ > inline Transpose<TranspositionsBase> transpose() const > { return Transpose<TranspositionsBase>(derived()); } > > protected: > }; > > namespace internal { >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType> >-struct traits<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType> >+struct traits<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,_IndexType> > > { >- typedef IndexType Index; >- typedef Matrix<Index, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; >+ typedef Matrix<_IndexType, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; >+ typedef typename IndicesType::Index Index; >+ typedef _IndexType IndexType; > }; > } > >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType> >-class Transpositions : public TranspositionsBase<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType> >+class Transpositions : public TranspositionsBase<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,_IndexType> > > { > typedef internal::traits<Transpositions> Traits; > public: > > typedef TranspositionsBase<Transpositions> Base; > typedef typename Traits::IndicesType IndicesType; >- typedef typename IndicesType::Scalar Index; >+ typedef typename IndicesType::Scalar IndexType; >+ typedef typename IndicesType::Index Index; >+ > > inline Transpositions() {} > > /** Copy constructor. */ > template<typename OtherDerived> > inline Transpositions(const TranspositionsBase<OtherDerived>& other) > : m_indices(other.indices()) {} > >@@ -210,40 +214,42 @@ class Transpositions : public Transposit > > protected: > > IndicesType m_indices; > }; > > > namespace internal { >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType, int _PacketAccess> >-struct traits<Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType>,_PacketAccess> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType, int _PacketAccess> >+struct traits<Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,_IndexType>,_PacketAccess> > > { >- typedef IndexType Index; >- typedef Map<const Matrix<Index,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1>, _PacketAccess> IndicesType; >+ typedef Map<const Matrix<_IndexType,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1>, _PacketAccess> IndicesType; >+ typedef typename IndicesType::Index Index; >+ typedef _IndexType IndexType; > }; > } > >-template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename IndexType, int PacketAccess> >-class Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType>,PacketAccess> >- : public TranspositionsBase<Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType>,PacketAccess> > >+template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename _IndexType, int PacketAccess> >+class Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,_IndexType>,PacketAccess> >+ : public TranspositionsBase<Map<Transpositions<SizeAtCompileTime,MaxSizeAtCompileTime,_IndexType>,PacketAccess> > > { > typedef internal::traits<Map> Traits; > public: > > typedef TranspositionsBase<Map> Base; > typedef typename Traits::IndicesType IndicesType; >- typedef typename IndicesType::Scalar Index; >+ typedef typename IndicesType::Scalar IndexType; >+ typedef typename IndicesType::Index Index; > >- inline Map(const Index* indicesPtr) >+ inline Map(const IndexType* indicesPtr) > : m_indices(indicesPtr) > {} > >- inline Map(const Index* indicesPtr, Index size) >+ inline Map(const IndexType* indicesPtr, Index size) > : m_indices(indicesPtr,size) > {} > > /** Copies the \a other transpositions into \c *this */ > template<typename OtherDerived> > Map& operator=(const TranspositionsBase<OtherDerived>& other) > { > return Base::operator=(other); >@@ -270,31 +276,33 @@ class Map<Transpositions<SizeAtCompileTi > > IndicesType m_indices; > }; > > namespace internal { > template<typename _IndicesType> > struct traits<TranspositionsWrapper<_IndicesType> > > { >- typedef typename _IndicesType::Scalar Index; >+ typedef typename _IndicesType::Scalar IndexType; >+ typedef typename _IndicesType::Index Index; > typedef _IndicesType IndicesType; > }; > } > > template<typename _IndicesType> > class TranspositionsWrapper > : public TranspositionsBase<TranspositionsWrapper<_IndicesType> > > { > typedef internal::traits<TranspositionsWrapper> Traits; > public: > > typedef TranspositionsBase<TranspositionsWrapper> Base; > typedef typename Traits::IndicesType IndicesType; >- typedef typename IndicesType::Scalar Index; >+ typedef typename IndicesType::Scalar IndexType; >+ typedef typename IndicesType::Index Index; > > inline TranspositionsWrapper(IndicesType& a_indices) > : m_indices(a_indices) > {} > > /** Copies the \a other transpositions into \c *this */ > template<typename OtherDerived> > TranspositionsWrapper& operator=(const TranspositionsBase<OtherDerived>& other) >@@ -358,34 +366,35 @@ struct traits<transposition_matrix_produ > }; > > template<typename TranspositionType, typename MatrixType, int Side, bool Transposed> > struct transposition_matrix_product_retval > : public ReturnByValue<transposition_matrix_product_retval<TranspositionType, MatrixType, Side, Transposed> > > { > typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned; > typedef typename TranspositionType::Index Index; >+ typedef typename TranspositionType::IndexType IndexType; > > transposition_matrix_product_retval(const TranspositionType& tr, const MatrixType& matrix) > : m_transpositions(tr), m_matrix(matrix) > {} > >- inline int rows() const { return m_matrix.rows(); } >- inline int cols() const { return m_matrix.cols(); } >+ inline Index rows() const { return m_matrix.rows(); } >+ inline Index cols() const { return m_matrix.cols(); } > > template<typename Dest> inline void evalTo(Dest& dst) const > { >- const int size = m_transpositions.size(); >- Index j = 0; >+ const Index size = m_transpositions.size(); >+ IndexType j = 0; > > if(!(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix))) > dst = m_matrix; > >- for(int k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k) >- if((j=m_transpositions.coeff(k))!=k) >+ for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k) >+ if(Index(j=m_transpositions.coeff(k))!=k) > { > if(Side==OnTheLeft) > dst.row(k).swap(dst.row(j)); > else if(Side==OnTheRight) > dst.col(k).swap(dst.col(j)); > } > } > >diff --git a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h >--- a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h >+++ b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h >@@ -26,17 +26,17 @@ namespace internal { > **/ > template <typename VectorV, typename VectorI, typename Index> > Index QuickSplit(VectorV &row, VectorI &ind, Index ncut) > { > typedef typename VectorV::RealScalar RealScalar; > using std::swap; > using std::abs; > Index mid; >- Index n = row.size(); /* length of the vector */ >+ Index n = Index(row.size()); /* length of the vector */ > Index first, last ; > > ncut--; /* to fit the zero-based indices */ > first = 0; > last = n-1; > if (ncut < first || ncut > last ) return 0; > > do { >diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h >--- a/Eigen/src/LU/PartialPivLU.h >+++ b/Eigen/src/LU/PartialPivLU.h >@@ -366,23 +366,23 @@ struct partial_lu_impl > } > return first_zero_pivot; > } > }; > > /** \internal performs the LU decomposition with partial pivoting in-place. > */ > template<typename MatrixType, typename TranspositionType> >-void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename TranspositionType::Index& nb_transpositions) >+void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, typename TranspositionType::IndexType& nb_transpositions) > { > eigen_assert(lu.cols() == row_transpositions.size()); > eigen_assert((&row_transpositions.coeffRef(1)-&row_transpositions.coeffRef(0)) == 1); > > partial_lu_impl >- <typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor, typename TranspositionType::Index> >+ <typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor, typename TranspositionType::IndexType> > ::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions); > } > > } // end namespace internal > > template<typename MatrixType> > PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix) > { >@@ -391,17 +391,17 @@ PartialPivLU<MatrixType>& PartialPivLU<M > > m_lu = matrix; > > eigen_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices"); > const Index size = matrix.rows(); > > m_rowsTranspositions.resize(size); > >- typename TranspositionType::Index nb_transpositions; >+ typename TranspositionType::IndexType nb_transpositions; > internal::partial_lu_inplace(m_lu, m_rowsTranspositions, nb_transpositions); > m_det_p = (nb_transpositions%2) ? -1 : 1; > > m_p = m_rowsTranspositions; > > m_isInitialized = true; > return *this; > } >diff --git a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h >--- a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h >+++ b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h >@@ -64,17 +64,16 @@ class CwiseBinaryOpImpl<BinaryOp, Lhs, R > } > }; > > template<typename BinaryOp, typename Lhs, typename Rhs> > class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator > : public internal::sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs,typename CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator> > { > public: >- typedef typename Lhs::Index Index; > typedef internal::sparse_cwise_binary_op_inner_iterator_selector< > BinaryOp,Lhs,Rhs, InnerIterator> Base; > > EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, Index outer) > : Base(binOp.derived(),outer) > {} > }; > >@@ -90,21 +89,21 @@ class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs > namespace internal { > > // sparse - sparse (generic) > template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived> > class sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, Sparse, Sparse> > { > typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> CwiseBinaryXpr; > typedef typename traits<CwiseBinaryXpr>::Scalar Scalar; >+ typedef typename traits<CwiseBinaryXpr>::Index Index; > typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested; > typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested; > typedef typename _LhsNested::InnerIterator LhsIterator; > typedef typename _RhsNested::InnerIterator RhsIterator; >- typedef typename Lhs::Index Index; > > public: > > EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer) > : m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor()) > { > this->operator++(); > } >@@ -156,21 +155,21 @@ class sparse_cwise_binary_op_inner_itera > > // sparse - sparse (product) > template<typename T, typename Lhs, typename Rhs, typename Derived> > class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Sparse> > { > typedef scalar_product_op<T> BinaryFunc; > typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr; > typedef typename CwiseBinaryXpr::Scalar Scalar; >+ typedef typename CwiseBinaryXpr::Index Index; > typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested; > typedef typename _LhsNested::InnerIterator LhsIterator; > typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested; > typedef typename _RhsNested::InnerIterator RhsIterator; >- typedef typename Lhs::Index Index; > public: > > EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer) > : m_lhsIter(xpr.lhs(),outer), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor()) > { > while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index())) > { > if (m_lhsIter.index() < m_rhsIter.index()) >@@ -210,25 +209,25 @@ class sparse_cwise_binary_op_inner_itera > > // sparse - dense (product) > template<typename T, typename Lhs, typename Rhs, typename Derived> > class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Sparse, Dense> > { > typedef scalar_product_op<T> BinaryFunc; > typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr; > typedef typename CwiseBinaryXpr::Scalar Scalar; >+ typedef typename CwiseBinaryXpr::Index Index; > typedef typename traits<CwiseBinaryXpr>::_LhsNested _LhsNested; > typedef typename traits<CwiseBinaryXpr>::RhsNested RhsNested; > typedef typename _LhsNested::InnerIterator LhsIterator; >- typedef typename Lhs::Index Index; > enum { IsRowMajor = (int(Lhs::Flags)&RowMajorBit)==RowMajorBit }; > public: > > EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer) >- : m_rhs(xpr.rhs()), m_lhsIter(xpr.lhs(),outer), m_functor(xpr.functor()), m_outer(outer) >+ : m_rhs(xpr.rhs()), m_lhsIter(xpr.lhs(),typename _LhsNested::Index(outer)), m_functor(xpr.functor()), m_outer(outer) > {} > > EIGEN_STRONG_INLINE Derived& operator++() > { > ++m_lhsIter; > return *static_cast<Derived*>(this); > } > >@@ -251,19 +250,19 @@ class sparse_cwise_binary_op_inner_itera > > // sparse - dense (product) > template<typename T, typename Lhs, typename Rhs, typename Derived> > class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs, Rhs, Derived, Dense, Sparse> > { > typedef scalar_product_op<T> BinaryFunc; > typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr; > typedef typename CwiseBinaryXpr::Scalar Scalar; >+ typedef typename CwiseBinaryXpr::Index Index; > typedef typename traits<CwiseBinaryXpr>::_RhsNested _RhsNested; > typedef typename _RhsNested::InnerIterator RhsIterator; >- typedef typename Lhs::Index Index; > > enum { IsRowMajor = (int(Rhs::Flags)&RowMajorBit)==RowMajorBit }; > public: > > EIGEN_STRONG_INLINE sparse_cwise_binary_op_inner_iterator_selector(const CwiseBinaryXpr& xpr, Index outer) > : m_xpr(xpr), m_rhsIter(xpr.rhs(),outer), m_functor(xpr.functor()), m_outer(outer) > {} > >diff --git a/Eigen/src/SparseCore/SparseDenseProduct.h b/Eigen/src/SparseCore/SparseDenseProduct.h >--- a/Eigen/src/SparseCore/SparseDenseProduct.h >+++ b/Eigen/src/SparseCore/SparseDenseProduct.h >@@ -91,18 +91,18 @@ class SparseDenseOuterProduct > } > > EIGEN_STRONG_INLINE SparseDenseOuterProduct(const Rhs& rhs, const Lhs& lhs) > : m_lhs(lhs), m_rhs(rhs) > { > EIGEN_STATIC_ASSERT(Tr,YOU_MADE_A_PROGRAMMING_MISTAKE); > } > >- EIGEN_STRONG_INLINE Index rows() const { return Tr ? m_rhs.rows() : m_lhs.rows(); } >- EIGEN_STRONG_INLINE Index cols() const { return Tr ? m_lhs.cols() : m_rhs.cols(); } >+ EIGEN_STRONG_INLINE Index rows() const { return Tr ? Index(m_rhs.rows()) : m_lhs.rows(); } >+ EIGEN_STRONG_INLINE Index cols() const { return Tr ? m_lhs.cols() : Index(m_rhs.cols()); } > > EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; } > EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; } > > protected: > LhsNested m_lhs; > RhsNested m_rhs; > }; >diff --git a/Eigen/src/SparseCore/SparseDiagonalProduct.h b/Eigen/src/SparseCore/SparseDiagonalProduct.h >--- a/Eigen/src/SparseCore/SparseDiagonalProduct.h >+++ b/Eigen/src/SparseCore/SparseDiagonalProduct.h >@@ -27,18 +27,20 @@ namespace Eigen { > namespace internal { > > template<typename Lhs, typename Rhs> > struct traits<SparseDiagonalProduct<Lhs, Rhs> > > { > typedef typename remove_all<Lhs>::type _Lhs; > typedef typename remove_all<Rhs>::type _Rhs; > typedef typename _Lhs::Scalar Scalar; >- typedef typename promote_index_type<typename traits<Lhs>::Index, >- typename traits<Rhs>::Index>::type Index; >+ // propagate the index type of the sparse matrix >+ typedef typename conditional< is_diagonal<_Lhs>::ret, >+ typename traits<Rhs>::Index, >+ typename traits<Lhs>::Index>::type Index; > typedef Sparse StorageKind; > typedef MatrixXpr XprKind; > enum { > RowsAtCompileTime = _Lhs::RowsAtCompileTime, > ColsAtCompileTime = _Rhs::ColsAtCompileTime, > > MaxRowsAtCompileTime = _Lhs::MaxRowsAtCompileTime, > MaxColsAtCompileTime = _Rhs::MaxColsAtCompileTime, >@@ -85,18 +87,18 @@ class SparseDiagonalProduct > class ReverseInnerIterator; > > EIGEN_STRONG_INLINE SparseDiagonalProduct(const Lhs& lhs, const Rhs& rhs) > : m_lhs(lhs), m_rhs(rhs) > { > eigen_assert(lhs.cols() == rhs.rows() && "invalid sparse matrix * diagonal matrix product"); > } > >- EIGEN_STRONG_INLINE Index rows() const { return m_lhs.rows(); } >- EIGEN_STRONG_INLINE Index cols() const { return m_rhs.cols(); } >+ EIGEN_STRONG_INLINE Index rows() const { return Index(m_lhs.rows()); } >+ EIGEN_STRONG_INLINE Index cols() const { return Index(m_rhs.cols()); } > > EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; } > EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; } > > protected: > LhsNested m_lhs; > RhsNested m_rhs; > }; >@@ -104,17 +106,17 @@ class SparseDiagonalProduct > namespace internal { > > template<typename Lhs, typename Rhs, typename SparseDiagonalProductType> > class sparse_diagonal_product_inner_iterator_selector > <Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor> > : public CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator > { > typedef typename CwiseUnaryOp<scalar_multiple_op<typename Lhs::Scalar>,const Rhs>::InnerIterator Base; >- typedef typename Lhs::Index Index; >+ typedef typename Rhs::Index Index; > public: > inline sparse_diagonal_product_inner_iterator_selector( > const SparseDiagonalProductType& expr, Index outer) > : Base(expr.rhs()*(expr.lhs().diagonal().coeff(outer)), outer) > {} > }; > > template<typename Lhs, typename Rhs, typename SparseDiagonalProductType> >@@ -124,17 +126,17 @@ class sparse_diagonal_product_inner_iter > scalar_product_op<typename Lhs::Scalar>, > const typename Rhs::ConstInnerVectorReturnType, > const typename Lhs::DiagonalVectorType>::InnerIterator > { > typedef typename CwiseBinaryOp< > scalar_product_op<typename Lhs::Scalar>, > const typename Rhs::ConstInnerVectorReturnType, > const typename Lhs::DiagonalVectorType>::InnerIterator Base; >- typedef typename Lhs::Index Index; >+ typedef typename Rhs::Index Index; > Index m_outer; > public: > inline sparse_diagonal_product_inner_iterator_selector( > const SparseDiagonalProductType& expr, Index outer) > : Base(expr.rhs().innerVector(outer) .cwiseProduct(expr.lhs().diagonal()), 0), m_outer(outer) > {} > > inline Index outer() const { return m_outer; } >diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h >--- a/Eigen/src/SparseCore/SparseMatrix.h >+++ b/Eigen/src/SparseCore/SparseMatrix.h >@@ -795,17 +795,19 @@ class SparseMatrix > # include EIGEN_SPARSEMATRIX_PLUGIN > # endif > > protected: > > template<typename Other> > void initAssignment(const Other& other) > { >- resize(other.rows(), other.cols()); >+ eigen_assert( other.rows() == typename Other::Index(Index(other.rows())) >+ && other.cols() == typename Other::Index(Index(other.cols())) ); >+ resize(Index(other.rows()), Index(other.cols())); > if(m_innerNonZeros) > { > std::free(m_innerNonZeros); > m_innerNonZeros = 0; > } > } > > /** \internal >@@ -935,17 +937,17 @@ namespace internal { > > template<typename InputIterator, typename SparseMatrixType> > void set_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, int Options = 0) > { > EIGEN_UNUSED_VARIABLE(Options); > enum { IsRowMajor = SparseMatrixType::IsRowMajor }; > typedef typename SparseMatrixType::Scalar Scalar; > typedef typename SparseMatrixType::Index Index; >- SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor> trMat(mat.rows(),mat.cols()); >+ SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor,Index> trMat(mat.rows(),mat.cols()); > > if(begin!=end) > { > // pass 1: count the nnz per inner-vector > Matrix<Index,Dynamic,1> wi(trMat.outerSize()); > wi.setZero(); > for(InputIterator it(begin); it!=end; ++it) > { >diff --git a/Eigen/src/SparseCore/SparseMatrixBase.h b/Eigen/src/SparseCore/SparseMatrixBase.h >--- a/Eigen/src/SparseCore/SparseMatrixBase.h >+++ b/Eigen/src/SparseCore/SparseMatrixBase.h >@@ -197,30 +197,30 @@ template<typename Derived> class SparseM > } > > protected: > > template<typename OtherDerived> > inline Derived& assign(const OtherDerived& other) > { > const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit); >- const Index outerSize = (int(OtherDerived::Flags) & RowMajorBit) ? other.rows() : other.cols(); >+ const Index outerSize = (int(OtherDerived::Flags) & RowMajorBit) ? Index(other.rows()) : Index(other.cols()); > if ((!transpose) && other.isRValue()) > { > // eval without temporary >- derived().resize(other.rows(), other.cols()); >+ derived().resize(Index(other.rows()), Index(other.cols())); > derived().setZero(); > derived().reserve((std::max)(this->rows(),this->cols())*2); > for (Index j=0; j<outerSize; ++j) > { > derived().startVec(j); >- for (typename OtherDerived::InnerIterator it(other, j); it; ++it) >+ for (typename OtherDerived::InnerIterator it(other, typename OtherDerived::Index(j)); it; ++it) > { > Scalar v = it.value(); >- derived().insertBackByOuterInner(j,it.index()) = v; >+ derived().insertBackByOuterInner(j,Index(it.index())) = v; > } > } > derived().finalize(); > } > else > { > assignGeneric(other); > } >@@ -232,29 +232,29 @@ template<typename Derived> class SparseM > { > //const bool transpose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit); > eigen_assert(( ((internal::traits<Derived>::SupportedAccessPatterns&OuterRandomAccessPattern)==OuterRandomAccessPattern) || > (!((Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit)))) && > "the transpose operation is supposed to be handled in SparseMatrix::operator="); > > enum { Flip = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit) }; > >- const Index outerSize = other.outerSize(); >+ const Index outerSize = Index(other.outerSize()); > //typedef typename internal::conditional<transpose, LinkedVectorMatrix<Scalar,Flags&RowMajorBit>, Derived>::type TempType; > // thanks to shallow copies, we always eval to a tempary >- Derived temp(other.rows(), other.cols()); >+ Derived temp(Index(other.rows()), Index(other.cols())); > > temp.reserve((std::max)(this->rows(),this->cols())*2); > for (Index j=0; j<outerSize; ++j) > { > temp.startVec(j); >- for (typename OtherDerived::InnerIterator it(other.derived(), j); it; ++it) >+ for (typename OtherDerived::InnerIterator it(other.derived(), typename OtherDerived::Index(j)); it; ++it) > { > Scalar v = it.value(); >- temp.insertBackByOuterInner(Flip?it.index():j,Flip?j:it.index()) = v; >+ temp.insertBackByOuterInner(Flip?Index(it.index()):j,Flip?j:Index(it.index())) = v; > } > } > temp.finalize(); > > derived() = temp.markAsRValue(); > } > > public: >@@ -396,17 +396,17 @@ template<typename Derived> class SparseM > const Block<const Derived,Dynamic,Dynamic,true> innerVectors(Index outerStart, Index outerSize) const; > > /** \internal use operator= */ > template<typename DenseDerived> > void evalTo(MatrixBase<DenseDerived>& dst) const > { > dst.setZero(); > for (Index j=0; j<outerSize(); ++j) >- for (typename Derived::InnerIterator i(derived(),j); i; ++i) >+ for (typename Derived::InnerIterator i(derived(),typename Derived::Index(j)); i; ++i) > dst.coeffRef(i.row(),i.col()) = i.value(); > } > > Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> toDense() const > { > return derived(); > } > >diff --git a/Eigen/src/SparseCore/SparseSelfAdjointView.h b/Eigen/src/SparseCore/SparseSelfAdjointView.h >--- a/Eigen/src/SparseCore/SparseSelfAdjointView.h >+++ b/Eigen/src/SparseCore/SparseSelfAdjointView.h >@@ -241,17 +241,17 @@ class SparseSelfAdjointTimeDenseProduct > enum { > LhsIsRowMajor = (_Lhs::Flags&RowMajorBit)==RowMajorBit, > ProcessFirstHalf = > ((UpLo&(Upper|Lower))==(Upper|Lower)) > || ( (UpLo&Upper) && !LhsIsRowMajor) > || ( (UpLo&Lower) && LhsIsRowMajor), > ProcessSecondHalf = !ProcessFirstHalf > }; >- for (Index j=0; j<m_lhs.outerSize(); ++j) >+ for (typename _Lhs::Index j=0; j<m_lhs.outerSize(); ++j) > { > LhsInnerIterator i(m_lhs,j); > if (ProcessSecondHalf) > { > while (i && i.index()<j) ++i; > if(i && i.index()==j) > { > dest.row(j) += i.value() * m_rhs.row(j); >diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h >--- a/Eigen/src/SparseQR/SparseQR.h >+++ b/Eigen/src/SparseQR/SparseQR.h >@@ -576,17 +576,17 @@ struct SparseQR_QProduct : ReturnByValue > { > typedef typename SparseQRType::QRMatrixType MatrixType; > typedef typename SparseQRType::Scalar Scalar; > typedef typename SparseQRType::Index Index; > // Get the references > SparseQR_QProduct(const SparseQRType& qr, const Derived& other, bool transpose) : > m_qr(qr),m_other(other),m_transpose(transpose) {} > inline Index rows() const { return m_transpose ? m_qr.rows() : m_qr.cols(); } >- inline Index cols() const { return m_other.cols(); } >+ inline Index cols() const { return Index(m_other.cols()); } > > // Assign to a vector > template<typename DesType> > void evalTo(DesType& res) const > { > Index m = m_qr.rows(); > Index n = m_qr.cols(); > Index diagSize = (std::min)(m,n);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 397
:
296
| 474