From db62719eda3f4bd6d8992eb911dfc0a4af0770b2 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 26 May 2016 17:42:12 +0200 Subject: [PATCH] Fix some conversion warnings in unit tests. --- test/geo_quaternion.cpp | 2 +- test/sparse_block.cpp | 3 ++- test/vectorwiseop.cpp | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp index f9e45f027..96889e722 100644 --- a/test/geo_quaternion.cpp +++ b/test/geo_quaternion.cpp @@ -31,7 +31,7 @@ template void check_slerp(const QuatType& q0, const QuatType& Scalar theta_tot = AA(q1*q0.inverse()).angle(); if(theta_tot>Scalar(EIGEN_PI)) - theta_tot = Scalar(2.*EIGEN_PI)-theta_tot; + theta_tot = Scalar(2.)*Scalar(EIGEN_PI)-theta_tot; for(Scalar t=0; t<=Scalar(1.001); t+=Scalar(0.1)) { QuatType q = q0.slerp(t,q1); diff --git a/test/sparse_block.cpp b/test/sparse_block.cpp index 582bf34c3..49a5f135e 100644 --- a/test/sparse_block.cpp +++ b/test/sparse_block.cpp @@ -17,6 +17,7 @@ template void sparse_block(const SparseMatrixType& re const Index outer = ref.outerSize(); typedef typename SparseMatrixType::Scalar Scalar; + typedef typename SparseMatrixType::StorageIndex StorageIndex; double density = (std::max)(8./(rows*cols), 0.01); typedef Matrix DenseMatrix; @@ -123,7 +124,7 @@ template void sparse_block(const SparseMatrixType& re m3.reserve(VectorXi::Constant(outer,int(inner/2))); for(Index j=0; j(k+1); for(Index j=0; j<(std::min)(outer, inner); ++j) { VERIFY(j==numext::real(m3.innerVector(j).nonZeros())); diff --git a/test/vectorwiseop.cpp b/test/vectorwiseop.cpp index 3cc198772..739eacaf3 100644 --- a/test/vectorwiseop.cpp +++ b/test/vectorwiseop.cpp @@ -233,10 +233,10 @@ template void vectorwiseop_matrix(const MatrixType& m) Matrix tmp(rows); VERIFY_EVALUATION_COUNT( tmp = (m1 * m1.transpose()).colwise().sum(), (MatrixType::RowsAtCompileTime==Dynamic ? 1 : 0)); - m2 = m1.rowwise() - (m1.colwise().sum()/m1.rows()).eval(); - m1 = m1.rowwise() - (m1.colwise().sum()/m1.rows()); + m2 = m1.rowwise() - (m1.colwise().sum()/RealScalar(m1.rows())).eval(); + m1 = m1.rowwise() - (m1.colwise().sum()/RealScalar(m1.rows())); VERIFY_IS_APPROX( m1, m2 ); - VERIFY_EVALUATION_COUNT( m2 = (m1.rowwise() - m1.colwise().sum()/m1.rows()), (MatrixType::RowsAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime!=1 ? 1 : 0) ); + VERIFY_EVALUATION_COUNT( m2 = (m1.rowwise() - m1.colwise().sum()/RealScalar(m1.rows())), (MatrixType::RowsAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime!=1 ? 1 : 0) ); } void test_vectorwiseop()