aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-07-08 16:47:11 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-07-08 16:47:11 +0200
commitb47ef1431f2e4d1218253df179b593cc5c269aa7 (patch)
tree37f8ebcfa5fc49a376f2eb3a13e19805274797e3 /test
parente25e6748521818fb13270f7351df8538eb54a056 (diff)
Fix many long to int implicit conversions
Diffstat (limited to 'test')
-rw-r--r--test/cholesky.cpp6
-rw-r--r--test/mapstaticmethods.cpp6
-rw-r--r--test/product_notemporary.cpp5
-rw-r--r--test/ref.cpp5
-rw-r--r--test/sparse.h4
-rw-r--r--test/sparse_basic.cpp8
6 files changed, 17 insertions, 17 deletions
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 1d147bd7a..a883192ab 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -181,7 +181,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
if(rows>=3)
{
SquareMatrixType A = symm;
- int c = internal::random<int>(0,rows-2);
+ Index c = internal::random<Index>(0,rows-2);
A.bottomRightCorner(c,c).setZero();
// Make sure a solution exists:
vecX.setRandom();
@@ -196,7 +196,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
// check non-full rank matrices
if(rows>=3)
{
- int r = internal::random<int>(1,rows-1);
+ Index r = internal::random<Index>(1,rows-1);
Matrix<Scalar,Dynamic,Dynamic> a = Matrix<Scalar,Dynamic,Dynamic>::Random(rows,r);
SquareMatrixType A = a * a.adjoint();
// Make sure a solution exists:
@@ -215,7 +215,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
RealScalar s = (std::min)(16,std::numeric_limits<RealScalar>::max_exponent10/8);
Matrix<Scalar,Dynamic,Dynamic> a = Matrix<Scalar,Dynamic,Dynamic>::Random(rows,rows);
Matrix<RealScalar,Dynamic,1> d = Matrix<RealScalar,Dynamic,1>::Random(rows);
- for(int k=0; k<rows; ++k)
+ for(Index k=0; k<rows; ++k)
d(k) = d(k)*std::pow(RealScalar(10),internal::random<RealScalar>(-s,s));
SquareMatrixType A = a * d.asDiagonal() * a.adjoint();
// Make sure a solution exists:
diff --git a/test/mapstaticmethods.cpp b/test/mapstaticmethods.cpp
index 5b512bde4..06272d106 100644
--- a/test/mapstaticmethods.cpp
+++ b/test/mapstaticmethods.cpp
@@ -69,7 +69,8 @@ struct mapstaticmethods_impl<PlainObjectType, true, false>
{
static void run(const PlainObjectType& m)
{
- int rows = m.rows(), cols = m.cols();
+ typedef typename PlainObjectType::Index Index;
+ Index rows = m.rows(), cols = m.cols();
int i = internal::random<int>(2,5), j = internal::random<int>(2,5);
@@ -115,7 +116,8 @@ struct mapstaticmethods_impl<PlainObjectType, true, true>
{
static void run(const PlainObjectType& v)
{
- int size = v.size();
+ typedef typename PlainObjectType::Index Index;
+ Index size = v.size();
int i = internal::random<int>(2,5);
diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp
index 258d238e2..3a9df618b 100644
--- a/test/product_notemporary.cpp
+++ b/test/product_notemporary.cpp
@@ -7,13 +7,12 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-static int nb_temporaries;
+static long int nb_temporaries;
-inline void on_temporary_creation(int size) {
+inline void on_temporary_creation(long int size) {
// here's a great place to set a breakpoint when debugging failures in this test!
if(size!=0) nb_temporaries++;
}
-
#define EIGEN_DENSE_STORAGE_CTOR_PLUGIN { on_temporary_creation(size); }
diff --git a/test/ref.cpp b/test/ref.cpp
index 19e81549c..d91e3b54c 100644
--- a/test/ref.cpp
+++ b/test/ref.cpp
@@ -12,13 +12,12 @@
#undef EIGEN_DEFAULT_TO_ROW_MAJOR
#endif
-static int nb_temporaries;
+static long int nb_temporaries;
-inline void on_temporary_creation(int) {
+inline void on_temporary_creation(long int) {
// here's a great place to set a breakpoint when debugging failures in this test!
nb_temporaries++;
}
-
#define EIGEN_DENSE_STORAGE_CTOR_PLUGIN { on_temporary_creation(size); }
diff --git a/test/sparse.h b/test/sparse.h
index e19a76316..81ab9e873 100644
--- a/test/sparse.h
+++ b/test/sparse.h
@@ -71,7 +71,7 @@ initSparse(double density,
//sparseMat.startVec(j);
for(Index i=0; i<sparseMat.innerSize(); i++)
{
- int ai(i), aj(j);
+ Index ai(i), aj(j);
if(IsRowMajor)
std::swap(ai,aj);
Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);
@@ -163,7 +163,7 @@ initSparse(double density,
{
sparseVec.reserve(int(refVec.size()*density));
sparseVec.setZero();
- for(Index i=0; i<refVec.size(); i++)
+ for(int i=0; i<refVec.size(); i++)
{
Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);
if (v!=Scalar(0))
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 6c620f037..4c9b9111e 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -147,7 +147,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
DenseMatrix m1(rows,cols);
m1.setZero();
SparseMatrixType m2(rows,cols);
- VectorXi r(VectorXi::Constant(m2.outerSize(), ((mode%2)==0) ? m2.innerSize() : std::max<int>(1,m2.innerSize()/8)));
+ VectorXi r(VectorXi::Constant(m2.outerSize(), ((mode%2)==0) ? int(m2.innerSize()) : std::max<int>(1,int(m2.innerSize())/8)));
m2.reserve(r);
for (int k=0; k<rows*cols; ++k)
{
@@ -181,7 +181,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
VERIFY_IS_APPROX(m2.innerVector(j0)+m2.innerVector(j1), refMat2.col(j0)+refMat2.col(j1));
SparseMatrixType m3(rows,rows);
- m3.reserve(VectorXi::Constant(rows,rows/2));
+ m3.reserve(VectorXi::Constant(rows,int(rows/2)));
for(Index j=0; j<rows; ++j)
for(Index k=0; k<j; ++k)
m3.insertByOuterInner(j,k) = k+1;
@@ -384,11 +384,11 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
{
typedef Triplet<Scalar,Index> TripletType;
std::vector<TripletType> triplets;
- int ntriplets = rows*cols;
+ Index ntriplets = rows*cols;
triplets.reserve(ntriplets);
DenseMatrix refMat(rows,cols);
refMat.setZero();
- for(int i=0;i<ntriplets;++i)
+ for(Index i=0;i<ntriplets;++i)
{
Index r = internal::random<Index>(0,rows-1);
Index c = internal::random<Index>(0,cols-1);