From f1679c7185471289afaf702a45e336849d20a81a Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Sun, 20 Jun 2010 17:37:56 +0200 Subject: Utilize Index in all unit tests. --- test/block.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'test/block.cpp') diff --git a/test/block.cpp b/test/block.cpp index a6bf47058..fcfa5191b 100644 --- a/test/block.cpp +++ b/test/block.cpp @@ -27,6 +27,7 @@ template void block(const MatrixType& m) { + typedef typename MatrixType::Index Index; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef Matrix VectorType; @@ -34,8 +35,8 @@ template void block(const MatrixType& m) typedef Matrix DynamicMatrixType; typedef Matrix 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 void block(const MatrixType& m) template 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 void data_and_stride(const MatrixType& m) { - int rows = m.rows(); - int cols = m.cols(); - - int r1 = ei_random(0,rows-1); - int r2 = ei_random(r1,rows-1); - int c1 = ei_random(0,cols-1); - int c2 = ei_random(c1,cols-1); + typedef typename MatrixType::Index Index; + Index rows = m.rows(); + Index cols = m.cols(); + + Index r1 = ei_random(0,rows-1); + Index r2 = ei_random(r1,rows-1); + Index c1 = ei_random(0,cols-1); + Index c2 = ei_random(c1,cols-1); MatrixType m1 = MatrixType::Random(rows, cols); compare_using_data_and_stride(m1.block(r1, c1, r2-r1+1, c2-c1+1)); -- cgit v1.2.3