aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/bandmatrix.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/bandmatrix.cpp
parente402d34407226d9c2c5dfc14ef5d6dbf53ee3c8e (diff)
Utilize Index in all unit tests.
Diffstat (limited to 'test/bandmatrix.cpp')
-rw-r--r--test/bandmatrix.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/test/bandmatrix.cpp b/test/bandmatrix.cpp
index dc54812b9..2745e527b 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 @@ template<typename MatrixType> void bandmatrix(const MatrixType& _m)
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 @@ template<typename MatrixType> void bandmatrix(const MatrixType& _m)
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)) );
}
}