Bugzilla – Attachment 296 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]
Proposed patch to fix loss of Integer Precision warnings.
TCW_diff.txt (text/plain), 5.60 KB, created by
Tobias Wood
on 2012-09-24 14:23:34 UTC
(
hide
)
Description:
Proposed patch to fix loss of Integer Precision warnings.
Filename:
MIME Type:
Creator:
Tobias Wood
Created:
2012-09-24 14:23:34 UTC
Size:
5.60 KB
patch
obsolete
>diff -r 8311f0d8ecd0 Eigen/src/Core/Assign.h >--- a/Eigen/src/Core/Assign.h Sat Sep 22 11:11:26 2012 +0200 >+++ b/Eigen/src/Core/Assign.h Mon Sep 24 13:15:44 2012 +0100 >@@ -218,7 +218,8 @@ > template<typename Derived1, typename Derived2, int Index, int Stop> > struct assign_innervec_InnerUnrolling > { >- static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, int outer) >+ typedef typename Derived1::Index IndexType; >+ static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, IndexType outer) > { > dst.template copyPacketByOuterInner<Derived2, Aligned, Aligned>(outer, Index, src); > assign_innervec_InnerUnrolling<Derived1, Derived2, >@@ -229,7 +230,8 @@ > template<typename Derived1, typename Derived2, int Stop> > struct assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop> > { >- static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, int) {} >+ typedef typename Derived1::Index IndexType; >+ static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, IndexType) {} > }; > > /*************************************************************************** >diff -r 8311f0d8ecd0 Eigen/src/Core/PermutationMatrix.h >--- a/Eigen/src/Core/PermutationMatrix.h Sat Sep 22 11:11:26 2012 +0200 >+++ b/Eigen/src/Core/PermutationMatrix.h Mon Sep 24 13:15:44 2012 +0100 >@@ -295,7 +295,7 @@ > > /** Constructs an uninitialized permutation matrix of given size. > */ >- inline PermutationMatrix(int size) : m_indices(size) >+ inline PermutationMatrix(IndexType size) : m_indices(size) > {} > > /** Copy constructor. */ >@@ -541,17 +541,17 @@ > : public ReturnByValue<permut_matrix_product_retval<PermutationType, MatrixType, Side, Transposed> > > { > typedef typename remove_all<typename MatrixType::Nested>::type MatrixTypeNestedCleaned; >- >+ typedef typename internal::traits<MatrixType>::Index Index; > permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) > : m_permutation(perm), 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 n = Side==OnTheLeft ? rows() : cols(); >+ const Index n = Side==OnTheLeft ? rows() : cols(); > > if(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix)) > { >@@ -566,10 +566,10 @@ > if(r>=m_permutation.size()) > break; > // we got one, let's follow it until we are back to the seed >- int k0 = r++; >- int kPrev = k0; >+ Index k0 = r++; >+ Index kPrev = k0; > mask.coeffRef(k0) = true; >- for(int k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) >+ for(Index k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) > { > Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>(dst, k) > .swap(Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime> >@@ -582,7 +582,7 @@ > } > else > { >- for(int i = 0; i < n; ++i) >+ for(Index i = 0; i < n; ++i) > { > Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime> > (dst, ((Side==OnTheLeft) ^ Transposed) ? m_permutation.indices().coeff(i) : i) >diff -r 8311f0d8ecd0 Eigen/src/Core/Transpositions.h >--- a/Eigen/src/Core/Transpositions.h Sat Sep 22 11:11:26 2012 +0200 >+++ b/Eigen/src/Core/Transpositions.h Mon Sep 24 13:15:44 2012 +0100 >@@ -99,7 +99,7 @@ > IndicesType& indices() { return derived().indices(); } > > /** Resizes to given size. */ >- inline void resize(int newSize) >+ inline void resize(Index newSize) > { > indices().resize(newSize); > } >diff -r 8311f0d8ecd0 Eigen/src/LU/PartialPivLU.h >--- a/Eigen/src/LU/PartialPivLU.h Sat Sep 22 11:11:26 2012 +0200 >+++ b/Eigen/src/LU/PartialPivLU.h Mon Sep 24 13:15:44 2012 +0100 >@@ -60,8 +60,8 @@ > typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; > typedef typename internal::traits<MatrixType>::StorageKind StorageKind; > typedef typename MatrixType::Index Index; >- typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationType; >- typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> TranspositionType; >+ typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime, Index> PermutationType; >+ typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime, Index> TranspositionType; > > > /** >@@ -242,7 +242,7 @@ > const Index cols = lu.cols(); > const Index size = (std::min)(rows,cols); > nb_transpositions = 0; >- int first_zero_pivot = -1; >+ Index first_zero_pivot = -1; > for(Index k = 0; k < size; ++k) > { > Index rrows = rows-k-1; >@@ -318,7 +318,7 @@ > } > > nb_transpositions = 0; >- int first_zero_pivot = -1; >+ Index first_zero_pivot = -1; > for(Index k = 0; k < size; k+=blockSize) > { > Index bs = (std::min)(size-k,blockSize); // actual size of the block >diff -r 8311f0d8ecd0 unsupported/Eigen/OpenGLSupport >--- a/unsupported/Eigen/OpenGLSupport Sat Sep 22 11:11:26 2012 +0200 >+++ b/unsupported/Eigen/OpenGLSupport Mon Sep 24 13:15:44 2012 +0100 >@@ -11,7 +11,7 @@ > #define EIGEN_OPENGL_MODULE > > #include <Eigen/Geometry> >-#include <GL/gl.h> >+#include <OpenGL/gl.h> > > namespace Eigen { >
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