Utilize Index in all unit tests.
diff --git a/test/adjoint.cpp b/test/adjoint.cpp index fc6c889..2cf9ef3 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp
@@ -31,13 +31,14 @@ /* this test covers the following files: Transpose.h Conjugate.h Dot.h */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType; - int rows = m.rows(); - int cols = m.cols(); + + Index rows = m.rows(); + Index cols = m.cols(); RealScalar largerEps = test_precision<RealScalar>(); if (ei_is_same_type<RealScalar,float>::ret) @@ -79,8 +80,8 @@ VERIFY(ei_isApprox(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), largerEps)); // like in testBasicStuff, test operator() to check const-qualification - int r = ei_random<int>(0, rows-1), - c = ei_random<int>(0, cols-1); + Index r = ei_random<Index>(0, rows-1), + c = ei_random<Index>(0, cols-1); VERIFY_IS_APPROX(m1.conjugate()(r,c), ei_conj(m1(r,c))); VERIFY_IS_APPROX(m1.adjoint()(c,r), ei_conj(m1(r,c)));
diff --git a/test/array.cpp b/test/array.cpp index 7f44b7d..aea8d20 100644 --- a/test/array.cpp +++ b/test/array.cpp
@@ -26,13 +26,14 @@ template<typename ArrayType> void array(const ArrayType& m) { + typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType; typedef Array<Scalar, 1, ArrayType::ColsAtCompileTime> RowVectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols), m2 = ArrayType::Random(rows, cols), @@ -78,12 +79,13 @@ template<typename ArrayType> void comparisons(const ArrayType& m) { + typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); int r = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1); @@ -137,11 +139,12 @@ template<typename ArrayType> void array_real(const ArrayType& m) { + typedef typename ArrayType::Index Index; typedef typename ArrayType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); ArrayType m1 = ArrayType::Random(rows, cols), m2 = ArrayType::Random(rows, cols),
diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp index 5d0b9bb..86637aa 100644 --- a/test/array_for_matrix.cpp +++ b/test/array_for_matrix.cpp
@@ -26,13 +26,14 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType; typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), @@ -75,15 +76,16 @@ template<typename MatrixType> void comparisons(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); - int r = ei_random<int>(0, rows-1), - c = ei_random<int>(0, cols-1); + Index r = ei_random<Index>(0, rows-1), + c = ei_random<Index>(0, cols-1); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols),
diff --git a/test/array_replicate.cpp b/test/array_replicate.cpp index 8c4845d..0a4c042 100644 --- a/test/array_replicate.cpp +++ b/test/array_replicate.cpp
@@ -29,15 +29,15 @@ /* this test covers the following files: Replicate.cpp */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, Dynamic, Dynamic> MatrixX; typedef Matrix<Scalar, Dynamic, 1> VectorX; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols);
diff --git a/test/array_reverse.cpp b/test/array_reverse.cpp index 3933ff5..144a0b0 100644 --- a/test/array_reverse.cpp +++ b/test/array_reverse.cpp
@@ -30,11 +30,12 @@ template<typename MatrixType> void reverse(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h
diff --git a/test/bandmatrix.cpp b/test/bandmatrix.cpp index dc54812..2745e52 100644 --- a/test/bandmatrix.cpp +++ b/test/bandmatrix.cpp
@@ -26,14 +26,15 @@ template<typename MatrixType> void bandmatrix(const MatrixType& _m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrixType; - int rows = _m.rows(); - int cols = _m.cols(); - int supers = _m.supers(); - int subs = _m.subs(); + Index rows = _m.rows(); + Index cols = _m.cols(); + Index supers = _m.supers(); + Index subs = _m.subs(); MatrixType m(rows,cols,supers,subs); @@ -60,9 +61,9 @@ m.col(i).setConstant(static_cast<RealScalar>(i+1)); dm1.col(i).setConstant(static_cast<RealScalar>(i+1)); } - int d = std::min(rows,cols); - int a = std::max(0,cols-d-supers); - int b = std::max(0,rows-d-subs); + Index d = std::min(rows,cols); + Index a = std::max(0,cols-d-supers); + Index b = std::max(0,rows-d-subs); if(a>0) dm1.block(0,d+supers,rows,a).setZero(); dm1.block(0,supers+1,cols-supers-1-a,cols-supers-1-a).template triangularView<Upper>().setZero(); dm1.block(subs+1,0,rows-subs-1-b,rows-subs-1-b).template triangularView<Lower>().setZero(); @@ -74,11 +75,13 @@ void test_bandmatrix() { + typedef BandMatrix<float>::Index Index; + for(int i = 0; i < 10*g_repeat ; i++) { - int rows = ei_random<int>(1,10); - int cols = ei_random<int>(1,10); - int sups = ei_random<int>(0,cols-1); - int subs = ei_random<int>(0,rows-1); + Index rows = ei_random<int(1,10); + Index cols = ei_random<int>(1,10); + Index sups = ei_random<int>(0,cols-1); + Index subs = ei_random<int>(0,rows-1); CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) ); } }
diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index ddddb59..e1afc0e 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp
@@ -28,11 +28,12 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h @@ -124,12 +125,13 @@ template<typename MatrixType> void basicStuffComplex(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); Scalar s1 = ei_random<Scalar>(), s2 = ei_random<Scalar>();
diff --git a/test/block.cpp b/test/block.cpp index a6bf470..fcfa519 100644 --- a/test/block.cpp +++ b/test/block.cpp
@@ -27,6 +27,7 @@ template<typename MatrixType> void block(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; @@ -34,8 +35,8 @@ typedef Matrix<Scalar, Dynamic, Dynamic> DynamicMatrixType; typedef Matrix<Scalar, Dynamic, 1> DynamicVectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), @@ -158,13 +159,14 @@ template<typename MatrixType> void compare_using_data_and_stride(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); - int size = m.size(); - int innerStride = m.innerStride(); - int outerStride = m.outerStride(); - int rowStride = m.rowStride(); - int colStride = m.colStride(); + typedef MatrixType::Index Index; + Index rows = m.rows(); + Index cols = m.cols(); + Index size = m.size(); + Index innerStride = m.innerStride(); + Index outerStride = m.outerStride(); + Index rowStride = m.rowStride(); + Index colStride = m.colStride(); const typename MatrixType::Scalar* data = m.data(); for(int j=0;j<cols;++j) @@ -191,13 +193,14 @@ template<typename MatrixType> void data_and_stride(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); + typedef typename MatrixType::Index Index; + Index rows = m.rows(); + Index cols = m.cols(); - int r1 = ei_random<int>(0,rows-1); - int r2 = ei_random<int>(r1,rows-1); - int c1 = ei_random<int>(0,cols-1); - int c2 = ei_random<int>(c1,cols-1); + Index r1 = ei_random<Index>(0,rows-1); + Index r2 = ei_random<Index>(r1,rows-1); + Index c1 = ei_random<Index>(0,cols-1); + Index c2 = ei_random<Index>(c1,cols-1); MatrixType m1 = MatrixType::Random(rows, cols); compare_using_data_and_stride(m1.block(r1, c1, r2-r1+1, c2-c1+1));
diff --git a/test/cholesky.cpp b/test/cholesky.cpp index 54ff94f..a178b82 100644 --- a/test/cholesky.cpp +++ b/test/cholesky.cpp
@@ -47,11 +47,12 @@ template<typename MatrixType> void cholesky(const MatrixType& m) { + typedef typename MatrixType::Index Index; /* this test covers the following files: LLT.h LDLT.h */ - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/test/conservative_resize.cpp b/test/conservative_resize.cpp index 825f23b..f0aff37 100644 --- a/test/conservative_resize.cpp +++ b/test/conservative_resize.cpp
@@ -32,6 +32,7 @@ void run_matrix_tests() { typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Storage> MatrixType; + typedef MatrixType::Index Index; MatrixType m, n; @@ -51,8 +52,8 @@ // random shrinking ... for (int i=0; i<25; ++i) { - const int rows = ei_random<int>(1,50); - const int cols = ei_random<int>(1,50); + const Index rows = ei_random<Index>(1,50); + const Index cols = ei_random<Index>(1,50); m = n = MatrixType::Random(50,50); m.conservativeResize(rows,cols); VERIFY_IS_APPROX(m, n.block(0,0,rows,cols)); @@ -61,8 +62,8 @@ // random growing with zeroing ... for (int i=0; i<25; ++i) { - const int rows = ei_random<int>(50,75); - const int cols = ei_random<int>(50,75); + const Index rows = ei_random<Index>(50,75); + const Index cols = ei_random<Index>(50,75); m = n = MatrixType::Random(50,50); m.conservativeResizeLike(MatrixType::Zero(rows,cols)); VERIFY_IS_APPROX(m.block(0,0,n.rows(),n.cols()), n);
diff --git a/test/corners.cpp b/test/corners.cpp index 3baea1b..70d12fd 100644 --- a/test/corners.cpp +++ b/test/corners.cpp
@@ -30,11 +30,12 @@ template<typename MatrixType> void corners(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); + typedef typename MatrixType::Index Index; + Index rows = m.rows(); + Index cols = m.cols(); - int r = ei_random<int>(1,rows); - int c = ei_random<int>(1,cols); + Index r = ei_random<Index>(1,rows); + Index c = ei_random<Index>(1,cols); MatrixType matrix = MatrixType::Random(rows,cols); const MatrixType const_matrix = MatrixType::Random(rows,cols);
diff --git a/test/cwiseop.cpp b/test/cwiseop.cpp index 8193c6e..ee7c8d2 100644 --- a/test/cwiseop.cpp +++ b/test/cwiseop.cpp
@@ -37,12 +37,13 @@ template<typename MatrixType> void cwiseops(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols),
diff --git a/test/diagonal.cpp b/test/diagonal.cpp index 288d58c..50b341d 100644 --- a/test/diagonal.cpp +++ b/test/diagonal.cpp
@@ -26,12 +26,14 @@ template<typename MatrixType> void diagonal(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType; - int rows = m.rows(); - int cols = m.cols(); + + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols);
diff --git a/test/diagonalmatrices.cpp b/test/diagonalmatrices.cpp index c24c66d..2bc75ba 100644 --- a/test/diagonalmatrices.cpp +++ b/test/diagonalmatrices.cpp
@@ -26,6 +26,7 @@ using namespace std; template<typename MatrixType> void diagonalmatrices(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime }; @@ -35,8 +36,8 @@ typedef DiagonalMatrix<Scalar, Rows> LeftDiagonalMatrix; typedef DiagonalMatrix<Scalar, Cols> RightDiagonalMatrix; typedef Matrix<Scalar, Rows==Dynamic?Dynamic:2*Rows, Cols==Dynamic?Dynamic:2*Cols> BigMatrix; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols);
diff --git a/test/eigen2support.cpp b/test/eigen2support.cpp index a18e7ed..274014c 100644 --- a/test/eigen2support.cpp +++ b/test/eigen2support.cpp
@@ -28,10 +28,11 @@ template<typename MatrixType> void eigen2support(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols),
diff --git a/test/eigensolver_complex.cpp b/test/eigensolver_complex.cpp index 1c1dd98..abb1f11 100644 --- a/test/eigensolver_complex.cpp +++ b/test/eigensolver_complex.cpp
@@ -47,11 +47,12 @@ template<typename MatrixType> void eigensolver(const MatrixType& m) { + typedef typename MatrixType::Index Index; /* this test covers the following files: ComplexEigenSolver.h, and indirectly ComplexSchur.h */ - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/test/eigensolver_generic.cpp b/test/eigensolver_generic.cpp index 92741a3..b261b7b 100644 --- a/test/eigensolver_generic.cpp +++ b/test/eigensolver_generic.cpp
@@ -33,11 +33,12 @@ template<typename MatrixType> void eigensolver(const MatrixType& m) { + typedef typename MatrixType::Index Index; /* this test covers the following files: EigenSolver.h */ - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/test/eigensolver_selfadjoint.cpp b/test/eigensolver_selfadjoint.cpp index e8da32d..2d7ac67 100644 --- a/test/eigensolver_selfadjoint.cpp +++ b/test/eigensolver_selfadjoint.cpp
@@ -33,11 +33,12 @@ template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m) { + typedef typename MatrixType::Index Index; /* this test covers the following files: EigenSolver.h, SelfAdjointEigenSolver.h (and indirectly: Tridiagonalization.h) */ - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/test/householder.cpp b/test/householder.cpp index 310eb8c..94ea5c6 100644 --- a/test/householder.cpp +++ b/test/householder.cpp
@@ -27,13 +27,14 @@ template<typename MatrixType> void householder(const MatrixType& m) { + typedef typename MatrixType::Index Index; static bool even = true; even = !even; /* this test covers the following files: Householder.h */ - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/test/integer_types.cpp b/test/integer_types.cpp index d2feb8a..abed4a6 100644 --- a/test/integer_types.cpp +++ b/test/integer_types.cpp
@@ -33,13 +33,14 @@ template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 }; VERIFY(is_signed == 1); - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1(rows, cols), m2 = MatrixType::Random(rows, cols), @@ -63,6 +64,7 @@ template<typename MatrixType> void integer_type_tests(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; VERIFY(NumTraits<Scalar>::IsInteger); @@ -71,8 +73,8 @@ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h
diff --git a/test/inverse.cpp b/test/inverse.cpp index 108ce7b..f050980 100644 --- a/test/inverse.cpp +++ b/test/inverse.cpp
@@ -28,11 +28,12 @@ template<typename MatrixType> void inverse(const MatrixType& m) { + typedef typename MatrixType::Index Index; /* this test covers the following files: Inverse.h */ - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp index bc9d937..401682e 100644 --- a/test/jacobisvd.cpp +++ b/test/jacobisvd.cpp
@@ -29,8 +29,9 @@ template<typename MatrixType, unsigned int Options> void svd(const MatrixType& m = MatrixType(), bool pickrandom = true) { - int rows = m.rows(); - int cols = m.cols(); + typedef typename MatrixType::Index Index; + Index rows = m.rows(); + Index cols = m.cols(); enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime,
diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp index 5300165..1d86af3 100644 --- a/test/linearstructure.cpp +++ b/test/linearstructure.cpp
@@ -29,11 +29,11 @@ /* this test covers the following files: Sum.h Difference.h Opposite.h ScalarMultiple.h */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h
diff --git a/test/lu.cpp b/test/lu.cpp index 9aa793e..8cb3cbb 100644 --- a/test/lu.cpp +++ b/test/lu.cpp
@@ -28,15 +28,16 @@ template<typename MatrixType> void lu_non_invertible() { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; /* this test covers the following files: LU.h */ - int rows, cols, cols2; + Index rows, cols, cols2; if(MatrixType::RowsAtCompileTime==Dynamic) { - rows = ei_random<int>(2,200); + rows = ei_random<Index>(2,200); } else { @@ -44,7 +45,7 @@ } if(MatrixType::ColsAtCompileTime==Dynamic) { - cols = ei_random<int>(2,200); + cols = ei_random<Index>(2,200); cols2 = ei_random<int>(2,200); } else @@ -63,7 +64,7 @@ typedef Matrix<typename MatrixType::Scalar, RowsAtCompileTime, RowsAtCompileTime> RMatrixType; - int rank = ei_random<int>(1, std::min(rows, cols)-1); + Index rank = ei_random<Index>(1, std::min(rows, cols)-1); // The image of the zero matrix should consist of a single (zero) column vector VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1)); @@ -145,10 +146,11 @@ /* this test covers the following files: PartialPivLU.h */ + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; - int rows = ei_random<int>(1,4); - int cols = rows; + Index rows = ei_random<Index>(1,4); + Index cols = rows; MatrixType m1(cols, rows); m1.setRandom();
diff --git a/test/main.h b/test/main.h index 184a35b..0f63a24 100644 --- a/test/main.h +++ b/test/main.h
@@ -385,7 +385,7 @@ * This is very useful to test rank-revealing algorithms. */ template<typename MatrixType> -void createRandomPIMatrixOfRank(int desired_rank, int rows, int cols, MatrixType& m) +void createRandomPIMatrixOfRank(typename MatrixType::Index desired_rank, typename MatrixType::Index rows, int cols, MatrixType& m) { typedef typename ei_traits<MatrixType>::Scalar Scalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
diff --git a/test/map.cpp b/test/map.cpp index 0204e9e..695d629 100644 --- a/test/map.cpp +++ b/test/map.cpp
@@ -53,9 +53,10 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; - int rows = m.rows(), cols = m.cols(), size = rows*cols; + Index rows = m.rows(), cols = m.cols(), size = rows*cols; // test Map.h Scalar* array1 = ei_aligned_new<Scalar>(size);
diff --git a/test/mapstride.cpp b/test/mapstride.cpp index 7a16056..ff6e71a 100644 --- a/test/mapstride.cpp +++ b/test/mapstride.cpp
@@ -61,9 +61,10 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; - int rows = _m.rows(), cols = _m.cols(); + Index rows = _m.rows(), cols = _m.cols(); MatrixType m = MatrixType::Random(rows,cols);
diff --git a/test/miscmatrices.cpp b/test/miscmatrices.cpp index 0adccf5..b14bca6 100644 --- a/test/miscmatrices.cpp +++ b/test/miscmatrices.cpp
@@ -29,14 +29,14 @@ /* this test covers the following files: DiagonalMatrix.h Ones.h */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); - int r = ei_random<int>(0, rows-1), r2 = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1); + Index r = ei_random<Index>(0, rows-1), r2 = ei_random<Index>(0, rows-1), c = ei_random<Index>(0, cols-1); VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast<Scalar>(1)); MatrixType m1 = MatrixType::Ones(rows,cols); VERIFY_IS_APPROX(m1(r,c), static_cast<Scalar>(1));
diff --git a/test/nomalloc.cpp b/test/nomalloc.cpp index 9eb8d13..f37dcd1 100644 --- a/test/nomalloc.cpp +++ b/test/nomalloc.cpp
@@ -43,12 +43,12 @@ { /* this test check no dynamic memory allocation are issued with fixed-size matrices */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), @@ -64,8 +64,8 @@ Scalar s1 = ei_random<Scalar>(); - int r = ei_random<int>(0, rows-1), - c = ei_random<int>(0, cols-1); + Index r = ei_random<Index>(0, rows-1), + c = ei_random<Index>(0, cols-1); VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2); VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c)));
diff --git a/test/nullary.cpp b/test/nullary.cpp index 6e91ddd..d463499 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp
@@ -97,8 +97,9 @@ template<typename MatrixType> void testMatrixType(const MatrixType& m) { - const int rows = m.rows(); - const int cols = m.cols(); + typedef typename MatrixType::Index Index; + const Index rows = m.rows(); + const Index cols = m.cols(); MatrixType A; A.setIdentity(rows, cols);
diff --git a/test/permutationmatrices.cpp b/test/permutationmatrices.cpp index 89142d9..d3cdfec 100644 --- a/test/permutationmatrices.cpp +++ b/test/permutationmatrices.cpp
@@ -43,6 +43,7 @@ using namespace std; template<typename MatrixType> void permutationmatrices(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime, @@ -52,8 +53,8 @@ typedef PermutationMatrix<Cols> RightPermutationType; typedef Matrix<int, Cols, 1> RightPermutationVectorType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m_original = MatrixType::Random(rows,cols); LeftPermutationVectorType lv;
diff --git a/test/product.h b/test/product.h index 71dc4bd..d004a4e 100644 --- a/test/product.h +++ b/test/product.h
@@ -37,7 +37,7 @@ /* this test covers the following files: Identity.h Product.h */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::NonInteger NonInteger; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> RowVectorType; @@ -47,8 +47,8 @@ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime, MatrixType::Flags&RowMajorBit> OtherMajorMatrixType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); // this test relies a lot on Random.h, and there's not much more that we can do // to test it, hence I consider that we will have tested Random.h
diff --git a/test/product_extra.cpp b/test/product_extra.cpp index 3644593..e53d675 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp
@@ -26,6 +26,7 @@ template<typename MatrixType> void product_extra(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::NonInteger NonInteger; typedef Matrix<Scalar, 1, Dynamic> RowVectorType; @@ -33,8 +34,8 @@ typedef Matrix<Scalar, Dynamic, Dynamic, MatrixType::Flags&RowMajorBit> OtherMajorMatrixType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols),
diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp index ca11403..84d73ff 100644 --- a/test/product_notemporary.cpp +++ b/test/product_notemporary.cpp
@@ -39,15 +39,15 @@ { /* This test checks the number of temporaries created * during the evaluation of a complex expression */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix<Scalar, 1, Dynamic> RowVectorType; typedef Matrix<Scalar, Dynamic, 1> ColVectorType; typedef Matrix<Scalar, Dynamic, Dynamic, RowMajor> RowMajorMatrixType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols),
diff --git a/test/product_selfadjoint.cpp b/test/product_selfadjoint.cpp index 2027fc8..10a661e 100644 --- a/test/product_selfadjoint.cpp +++ b/test/product_selfadjoint.cpp
@@ -26,6 +26,7 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; @@ -33,8 +34,8 @@ typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic, RowMajor> RhsMatrixType; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols),
diff --git a/test/product_symm.cpp b/test/product_symm.cpp index 08e0a60..92a3f45 100644 --- a/test/product_symm.cpp +++ b/test/product_symm.cpp
@@ -50,9 +50,10 @@ typedef Matrix<Scalar, OtherSize, Size> Rhs2; enum { order = OtherSize==1 ? 0 : RowMajor }; typedef Matrix<Scalar, Size, OtherSize,order> Rhs3; + typedef MatrixType::Index Index; - int rows = size; - int cols = size; + Index rows = size; + Index cols = size; MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols), m3;
diff --git a/test/product_syrk.cpp b/test/product_syrk.cpp index ec93056..18cdda1 100644 --- a/test/product_syrk.cpp +++ b/test/product_syrk.cpp
@@ -26,14 +26,15 @@ template<typename MatrixType> void syrk(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> Rhs1; typedef Matrix<Scalar, Dynamic, MatrixType::RowsAtCompileTime> Rhs2; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic,RowMajor> Rhs3; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols);
diff --git a/test/product_trmm.cpp b/test/product_trmm.cpp index a689deb..3826184 100644 --- a/test/product_trmm.cpp +++ b/test/product_trmm.cpp
@@ -31,8 +31,8 @@ typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> MatrixColMaj; typedef Matrix<Scalar,Dynamic,Dynamic,RowMajor> MatrixRowMaj; - int rows = size; - int cols = ei_random<int>(1,size); + DenseIndex rows = size; + DenseIndex cols = ei_random<DenseIndex>(1,size); MatrixColMaj triV(rows,cols), triH(cols,rows), upTri(cols,rows), loTri(rows,cols), unitUpTri(cols,rows), unitLoTri(rows,cols);
diff --git a/test/product_trmv.cpp b/test/product_trmv.cpp index 2f57431..19210b0 100644 --- a/test/product_trmv.cpp +++ b/test/product_trmv.cpp
@@ -26,14 +26,15 @@ template<typename MatrixType> void trmv(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; RealScalar largerEps = 10*test_precision<RealScalar>(); - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m3(rows, cols);
diff --git a/test/qr.cpp b/test/qr.cpp index eae336e..2218bdc 100644 --- a/test/qr.cpp +++ b/test/qr.cpp
@@ -27,8 +27,10 @@ template<typename MatrixType> void qr(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); + typedef typename MatrixType::Index Index; + + Index rows = m.rows(); + Index cols = m.cols(); typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp index 7064bc2..94b8efb 100644 --- a/test/qr_colpivoting.cpp +++ b/test/qr_colpivoting.cpp
@@ -28,8 +28,10 @@ template<typename MatrixType> void qr() { - int rows = ei_random<int>(2,200), cols = ei_random<int>(2,200), cols2 = ei_random<int>(2,200); - int rank = ei_random<int>(1, std::min(rows, cols)-1); + typedef typename MatrixType::Index Index; + + Index rows = ei_random<Index>(2,200), cols = ei_random<Index>(2,200), cols2 = ei_random<Index>(2,200); + Index rank = ei_random<Index>(1, std::min(rows, cols)-1); typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar;
diff --git a/test/qr_fullpivoting.cpp b/test/qr_fullpivoting.cpp index 33350ce..6f7831c 100644 --- a/test/qr_fullpivoting.cpp +++ b/test/qr_fullpivoting.cpp
@@ -28,8 +28,10 @@ template<typename MatrixType> void qr() { - int rows = ei_random<int>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200); - int rank = ei_random<int>(1, std::min(rows, cols)-1); + typedef typename MatrixType::Index Index; + + Index rows = ei_random<int>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200); + Index rank = ei_random<int>(1, std::min(rows, cols)-1); typedef typename MatrixType::Scalar Scalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
diff --git a/test/qtvector.cpp b/test/qtvector.cpp index bc780b4..b9bb9d0 100644 --- a/test/qtvector.cpp +++ b/test/qtvector.cpp
@@ -33,8 +33,10 @@ template<typename MatrixType> void check_qtvector_matrix(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); + typedef typename MatrixType::Index Index; + + Index rows = m.rows(); + Index cols = m.cols(); MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); QVector<MatrixType> v(10, MatrixType(rows,cols)), w(20, y); for(int i = 0; i < 20; i++)
diff --git a/test/redux.cpp b/test/redux.cpp index 104cd4c..2dfe8cb 100644 --- a/test/redux.cpp +++ b/test/redux.cpp
@@ -26,11 +26,12 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols);
diff --git a/test/resize.cpp b/test/resize.cpp index dfe3bda..48818ac 100644 --- a/test/resize.cpp +++ b/test/resize.cpp
@@ -24,7 +24,7 @@ #include "main.h" -template<int rows, int cols> +template<DenseIndex rows, DenseIndex cols> void resizeLikeTest() { MatrixXf A(rows, cols);
diff --git a/test/selfadjoint.cpp b/test/selfadjoint.cpp index 1ea5a3a..9e3ccb4 100644 --- a/test/selfadjoint.cpp +++ b/test/selfadjoint.cpp
@@ -29,11 +29,12 @@ template<typename MatrixType> void selfadjoint(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); MatrixType m1 = MatrixType::Random(rows, cols), m3(rows, cols);
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 3d22109..3ebd592 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp
@@ -26,8 +26,10 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& ref) { - const int rows = ref.rows(); - const int cols = ref.cols(); + typedef typename SparseMatrixType::Index Index; + + const Index rows = ref.rows(); + const Index cols = ref.cols(); typedef typename SparseMatrixType::Scalar Scalar; enum { Flags = SparseMatrixType::Flags };
diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp index 04e0897..c07735e 100644 --- a/test/sparse_product.cpp +++ b/test/sparse_product.cpp
@@ -26,8 +26,9 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType& ref) { - const int rows = ref.rows(); - const int cols = ref.cols(); + typedef typename SparseMatrixType::Index Index; + const Index rows = ref.rows(); + const Index cols = ref.cols(); typedef typename SparseMatrixType::Scalar Scalar; enum { Flags = SparseMatrixType::Flags };
diff --git a/test/stable_norm.cpp b/test/stable_norm.cpp index 77b0623..74675e9 100644 --- a/test/stable_norm.cpp +++ b/test/stable_norm.cpp
@@ -34,7 +34,7 @@ /* this test covers the following files: StableNorm.h */ - + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; @@ -52,8 +52,8 @@ } - int rows = m.rows(); - int cols = m.cols(); + Index rows = m.rows(); + Index cols = m.cols(); Scalar big = ei_random<Scalar>() * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4)); Scalar small = static_cast<RealScalar>(1)/big;
diff --git a/test/stdlist.cpp b/test/stdlist.cpp index 7a54d46..a410b3e 100644 --- a/test/stdlist.cpp +++ b/test/stdlist.cpp
@@ -30,8 +30,10 @@ template<typename MatrixType> void check_stdlist_matrix(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); + typedef typename MatrixType::Index Index; + + Index rows = m.rows(); + Index cols = m.cols(); MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); std::list<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y); v.front() = x;
diff --git a/test/stdvector.cpp b/test/stdvector.cpp index bdca826..b44dadf 100644 --- a/test/stdvector.cpp +++ b/test/stdvector.cpp
@@ -29,8 +29,8 @@ template<typename MatrixType> void check_stdvector_matrix(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); + typename MatrixType::Index rows = m.rows(); + typename MatrixType::Index cols = m.cols(); MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols); std::vector<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y); v[5] = x;
diff --git a/unsupported/Eigen/AlignedVector3 b/unsupported/Eigen/AlignedVector3 index 6e9772c..7efe4ac 100644 --- a/unsupported/Eigen/AlignedVector3 +++ b/unsupported/Eigen/AlignedVector3
@@ -68,19 +68,19 @@ EIGEN_DENSE_PUBLIC_INTERFACE(AlignedVector3) using Base::operator*; - inline int rows() const { return 3; } - inline int cols() const { return 1; } + inline Index rows() const { return 3; } + inline Index cols() const { return 1; } - inline const Scalar& coeff(int row, int col) const + inline const Scalar& coeff(Index row, Index col) const { return m_coeffs.coeff(row, col); } - inline Scalar& coeffRef(int row, int col) + inline Scalar& coeffRef(Index row, Index col) { return m_coeffs.coeffRef(row, col); } - inline const Scalar& coeff(int index) const + inline const Scalar& coeff(Index index) const { return m_coeffs.coeff(index); } - inline Scalar& coeffRef(int index) + inline Scalar& coeffRef(Index index) { return m_coeffs.coeffRef(index);}
diff --git a/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h b/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h index 9506247..9c0dfcc 100644 --- a/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h +++ b/unsupported/Eigen/src/SparseExtra/UmfPackSupport.h
@@ -200,8 +200,9 @@ template<typename MatrixType> void SparseLU<MatrixType,UmfPack>::compute(const MatrixType& a) { - const int rows = a.rows(); - const int cols = a.cols(); + typedef typename MatrixType::Index Index; + const Index rows = a.rows(); + const Index cols = a.cols(); ei_assert((MatrixType::Flags&RowMajorBit)==0 && "Row major matrices are not supported yet"); m_matrixRef = &a;
diff --git a/unsupported/test/sparse_extra.cpp b/unsupported/test/sparse_extra.cpp index fa6dc50..6cf1f50 100644 --- a/unsupported/test/sparse_extra.cpp +++ b/unsupported/test/sparse_extra.cpp
@@ -61,8 +61,9 @@ template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& ref) { - const int rows = ref.rows(); - const int cols = ref.cols(); + typedef typename SparseMatrixType::Index Index; + const Index rows = ref.rows(); + const Index cols = ref.cols(); typedef typename SparseMatrixType::Scalar Scalar; enum { Flags = SparseMatrixType::Flags };