diff --git a/Eigen/src/Core/PermutationMatrix.h b/Eigen/src/Core/PermutationMatrix.h index 42832265d..a996e8f1e 100644 --- a/Eigen/src/Core/PermutationMatrix.h +++ b/Eigen/src/Core/PermutationMatrix.h @@ -127,7 +127,7 @@ class PermutationMatrix : public EigenBase& tr) { setIdentity(tr.size()); - for(int k=size()-1; k>=0; --k) + for(Index k=size()-1; k>=0; --k) applyTranspositionOnTheRight(k,tr.coeff(k)); return *this; } @@ -144,13 +144,13 @@ class PermutationMatrix : public EigenBase @@ -178,7 +178,7 @@ class PermutationMatrix : public EigenBase=0 && j>=0 && i=0 && j>=0 && i void reverse(const MatrixType& m) Scalar x = ei_random(); - int r = ei_random(0, rows-1), - c = ei_random(0, cols-1); + Index r = ei_random(0, rows-1), + c = ei_random(0, cols-1); m1.reverse()(r, c) = x; VERIFY_IS_APPROX(x, m1(rows - 1 - r, cols - 1 - c)); diff --git a/test/permutationmatrices.cpp b/test/permutationmatrices.cpp index d3cdfeca0..880cd87a9 100644 --- a/test/permutationmatrices.cpp +++ b/test/permutationmatrices.cpp @@ -25,17 +25,18 @@ #include "main.h" template -void randomPermutationVector(PermutationVectorType& v, int size) +void randomPermutationVector(PermutationVectorType& v, typename PermutationVectorType::Index size) { + typedef typename PermutationVectorType::Index Index; typedef typename PermutationVectorType::Scalar Scalar; v.resize(size); - for(int i = 0; i < size; ++i) v(i) = Scalar(i); + for(Index i = 0; i < size; ++i) v(i) = Scalar(i); if(size == 1) return; - for(int n = 0; n < 3 * size; ++n) + for(Index n = 0; n < 3 * size; ++n) { - int i = ei_random(0, size-1); - int j; - do j = ei_random(0, size-1); while(j==i); + Index i = ei_random(0, size-1); + Index j; + do j = ei_random(0, size-1); while(j==i); std::swap(v(i), v(j)); } } @@ -107,17 +108,17 @@ template void permutationmatrices(const MatrixType& m) if(rows>1 && cols>1) { lp2 = lp; - int i = ei_random(0, rows-1); - int j; - do j = ei_random(0, rows-1); while(j==i); + Index i = ei_random(0, rows-1); + Index j; + do j = ei_random(0, rows-1); while(j==i); lp2.applyTranspositionOnTheLeft(i, j); lm = lp; lm.row(i).swap(lm.row(j)); VERIFY_IS_APPROX(lm, lp2.toDenseMatrix().template cast()); RightPermutationType rp2 = rp; - i = ei_random(0, cols-1); - do j = ei_random(0, cols-1); while(j==i); + i = ei_random(0, cols-1); + do j = ei_random(0, cols-1); while(j==i); rp2.applyTranspositionOnTheRight(i, j); rm = rp; rm.col(i).swap(rm.col(j)); diff --git a/test/product_extra.cpp b/test/product_extra.cpp index e53d675c3..b55d3d5ed 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp @@ -105,12 +105,12 @@ template void product_extra(const MatrixType& m) (-m1.adjoint()*s2).eval() * (s1 * v1.adjoint()).eval()); // test the vector-matrix product with non aligned starts - int i = ei_random(0,m1.rows()-2); - int j = ei_random(0,m1.cols()-2); - int r = ei_random(1,m1.rows()-i); - int c = ei_random(1,m1.cols()-j); - int i2 = ei_random(0,m1.rows()-1); - int j2 = ei_random(0,m1.cols()-1); + Index i = ei_random(0,m1.rows()-2); + Index j = ei_random(0,m1.cols()-2); + Index r = ei_random(1,m1.rows()-i); + Index c = ei_random(1,m1.cols()-j); + Index i2 = ei_random(0,m1.rows()-1); + Index j2 = ei_random(0,m1.cols()-1); VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),c).eval()); VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).eval() * m1.row(i2).adjoint().eval()); diff --git a/unsupported/test/polynomialsolver.cpp b/unsupported/test/polynomialsolver.cpp index 1f2d7e1f3..f6a574a60 100644 --- a/unsupported/test/polynomialsolver.cpp +++ b/unsupported/test/polynomialsolver.cpp @@ -47,12 +47,13 @@ struct ei_increment_if_fixed_size template bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve ) { + typedef typename POLYNOMIAL::Index Index; typedef typename POLYNOMIAL::Scalar Scalar; typedef typename SOLVER::RootsType RootsType; typedef Matrix EvalRootsType; - const int deg = pols.size()-1; + const Index deg = pols.size()-1; psolve.compute( pols ); const RootsType& roots( psolve.roots() );