From f34eaa2628181f94262ea87c3cd48ad116915551 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Sun, 20 Jun 2010 21:44:25 +0200 Subject: Next try - more Index fixes. --- test/permutationmatrices.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'test/permutationmatrices.cpp') 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)); -- cgit v1.2.3