aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/block.cpp
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-06-20 17:37:56 +0200
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-06-20 17:37:56 +0200
commitf1679c7185471289afaf702a45e336849d20a81a (patch)
tree2d6d649c8d0ae0985dfeaae2fdf2da47294264ae /test/block.cpp
parente402d34407226d9c2c5dfc14ef5d6dbf53ee3c8e (diff)
Utilize Index in all unit tests.
Diffstat (limited to 'test/block.cpp')
-rw-r--r--test/block.cpp35
1 files changed, 19 insertions, 16 deletions
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<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 @@ template<typename MatrixType> void block(const MatrixType& m)
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 block(const MatrixType& m)
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 @@ void compare_using_data_and_stride(const MatrixType& m)
template<typename MatrixType>
void data_and_stride(const MatrixType& m)
{
- int rows = m.rows();
- int 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);
+ typedef typename MatrixType::Index Index;
+ Index rows = m.rows();
+ Index cols = m.cols();
+
+ 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));