New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 808 - a bunch of problems with 'long int' indexes
a bunch of problems with 'long int' indexes
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - general
3.2
x86 - 64-bit Linux
: Normal critical
Assigned To: Nobody
:
Depends on:
Blocks: 397
  Show dependency treegraph
 
Reported: 2014-05-06 19:34 UTC by Albert
Modified: 2014-07-08 19:15 UTC (History)
3 users (show)



Attachments

Description Albert 2014-05-06 19:34:23 UTC
Hi All,

I have RedHat 6.5/64-bit, g++ 4.4.7. Long int indexes cause some problems. All but one of them I had fixed in my local copy of Eigen library. However, the 2nd one is still there.

Serious error - forgotten template parameter in the temporary matrix.
/usr/local/include/eigen3/Eigen/src/SparseCore/SparseMatrix.h:943
--- was:
SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor> trMat(mat.rows(),mat.cols());
--- now:
SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor,Index> trMat(mat.rows(),mat.cols());


Serious error:
/usr/local/include/eigen3/Eigen/src/Core/Functors.h:592:79:
warning: conversion to ‘double’ from ‘long int’ may alter its value
template<typename Index>
EIGEN_STRONG_INLINE const Packet packetOp(Index i) const
{ return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1<Packet>(i),m_interPacket))); }
--- possible reason: pset1() for 'long int' is not defined at:
/usr/local/include/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h:113
template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float&  from) { return _mm_set1_ps(from); }
template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) { return _mm_set1_pd(from); }
template<> EIGEN_STRONG_INLINE Packet4i pset1<Packet4i>(const int&    from) { return _mm_set1_epi32(from); }


warning: conversion to ‘long int’ from ‘double’ may alter its value
/usr/local/include/eigen3/Eigen/src/Core/Functors.h:588
--- was:
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; }
--- now:
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+static_cast<Scalar>(i)*m_step; }


warning: conversion to ‘float’ from ‘size_t’ may alter its value
/usr/local/include/eigen3/Eigen/src/SparseCore/CompressedStorage.h:89
--- was:
reallocate(size + size_t(reserveSizeFactor*size));
--- now:
reallocate(size + size_t(static_cast<double>(reserveSizeFactor)*static_cast<double>(size)));


yet another conversion warning:
/usr/local/include/eigen3/Eigen/src/Core/Functors.h:612
--- was:
linspaced_op(const Scalar& low, const Scalar& high, DenseIndex num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {}
--- now:
linspaced_op(const Scalar& low, const Scalar& high, DenseIndex num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/static_cast<Scalar>(num_steps-1))) {}
Comment 1 Jitse Niesen 2014-05-23 19:30:05 UTC
Thanks for the report. Do you have a small program (or a fragment) that triggers these warnings and errors? That would help us fixing the bugs.
Comment 2 Gael Guennebaud 2014-07-08 19:14:30 UTC
I'm closing this bug, but it would still be useful to know the compiler flag which triggers these warnings.

https://bitbucket.org/eigen/eigen/commits/69c99821a45e/
https://bitbucket.org/eigen/eigen/commits/23493b2f2875/
Summary:     Bug 808: use double instead of float for the increasing size ratio in CompressedStorage::resize

https://bitbucket.org/eigen/eigen/commits/8378d69c8c2e/
https://bitbucket.org/eigen/eigen/commits/37c9501f10b4/
Summary:     Bug 808: fix implicit conversions from int/longint to float/double

https://bitbucket.org/eigen/eigen/commits/b5d09b72ac76/
Branch:      3.2
Summary:     Bug 808: fix set_from_triplets temporary matrix type (already fixed in the devel branch)

Note You need to log in before you can comment on or make changes to this bug.