Fix compilation of some tests as well as more warnings.

This commit is contained in:
Hauke Heibel 2010-06-20 18:59:15 +02:00
parent f1679c7185
commit cb11f2f8a6
6 changed files with 24 additions and 22 deletions

View File

@ -87,8 +87,8 @@ template<typename ArrayType> void comparisons(const ArrayType& m)
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);
ArrayType m1 = ArrayType::Random(rows, cols),
m2 = ArrayType::Random(rows, cols),

View File

@ -62,8 +62,8 @@ template<typename MatrixType> void bandmatrix(const MatrixType& _m)
dm1.col(i).setConstant(static_cast<RealScalar>(i+1));
}
Index d = std::min(rows,cols);
Index a = std::max(0,cols-d-supers);
Index b = std::max(0,rows-d-subs);
Index a = std::max<Index>(0,cols-d-supers);
Index b = std::max<Index>(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();
@ -78,10 +78,10 @@ void test_bandmatrix()
typedef BandMatrix<float>::Index Index;
for(int i = 0; i < 10*g_repeat ; i++) {
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);
Index rows = ei_random<Index>(1,10);
Index cols = ei_random<Index>(1,10);
Index sups = ei_random<Index>(0,cols-1);
Index subs = ei_random<Index>(0,rows-1);
CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
}
}

View File

@ -50,10 +50,10 @@ template<typename MatrixType> void block(const MatrixType& m)
Scalar s1 = ei_random<Scalar>();
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);
//check row() and col()
VERIFY_IS_EQUAL(m1.col(c1).transpose(), m1.transpose().row(c1));
@ -95,12 +95,12 @@ template<typename MatrixType> void block(const MatrixType& m)
VERIFY_IS_EQUAL(v1.template head<2>(), v1.head(2));
VERIFY_IS_EQUAL(v1.template head<2>(), v1.segment(0,2));
VERIFY_IS_EQUAL(v1.template head<2>(), v1.template segment<2>(0));
int i = rows-2;
Index i = rows-2;
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.block(i,0,2,1));
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.tail(2));
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.segment(i,2));
VERIFY_IS_EQUAL(v1.template tail<2>(), v1.template segment<2>(i));
i = ei_random(0,rows-2);
i = ei_random<Index>(0,rows-2);
VERIFY_IS_EQUAL(v1.segment(i,2), v1.template segment<2>(i));
}

View File

@ -94,8 +94,8 @@ template<typename MatrixType> void householder(const MatrixType& m)
// test householder sequence on the left with a shift
int shift = ei_random(0, std::max(rows-2,0));
int brows = rows - shift;
Index shift = ei_random<Index>(0, std::max<Index>(rows-2,0));
Index brows = rows - shift;
m1.setRandom(rows, cols);
HBlockMatrixType hbm = m1.block(shift,0,brows,cols);
HouseholderQR<HBlockMatrixType> qr(hbm);

View File

@ -54,11 +54,11 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m)
VERIFY_IS_APPROX(m1.real().minCoeff(), ei_real(minc));
VERIFY_IS_APPROX(m1.real().maxCoeff(), ei_real(maxc));
// test sclice vectorization assuming assign is ok
int r0 = ei_random<int>(0,rows-1);
int c0 = ei_random<int>(0,cols-1);
int r1 = ei_random<int>(r0+1,rows)-r0;
int c1 = ei_random<int>(c0+1,cols)-c0;
// test slice vectorization assuming assign is ok
Index r0 = ei_random<Index>(0,rows-1);
Index c0 = ei_random<Index>(0,cols-1);
Index r1 = ei_random<Index>(r0+1,rows)-r0;
Index c1 = ei_random<Index>(c0+1,cols)-c0;
VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).sum(), m1.block(r0,c0,r1,c1).eval().sum());
VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).mean(), m1.block(r0,c0,r1,c1).eval().mean());
VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).prod(), m1.block(r0,c0,r1,c1).eval().prod());

View File

@ -28,7 +28,9 @@
template<typename MatrixType> void verifyIsQuasiTriangular(const MatrixType& T)
{
const int size = T.cols();
typedef typename MatrixType::Index Index;
const Index size = T.cols();
typedef typename MatrixType::Scalar Scalar;
// Check T is lower Hessenberg