diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-05-26 17:42:12 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-05-26 17:42:12 +0200 |
commit | db62719eda3f4bd6d8992eb911dfc0a4af0770b2 (patch) | |
tree | 95cd30f5b208bccc44efd4c6bd007c7093e28cec | |
parent | fdcad686eea0123049c0fc1d4b5cb50894a08ef6 (diff) |
Fix some conversion warnings in unit tests.
-rw-r--r-- | test/geo_quaternion.cpp | 2 | ||||
-rw-r--r-- | test/sparse_block.cpp | 3 | ||||
-rw-r--r-- | 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<typename QuatType> 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<typename SparseMatrixType> 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<Scalar,Dynamic,Dynamic> DenseMatrix; @@ -123,7 +124,7 @@ template<typename SparseMatrixType> void sparse_block(const SparseMatrixType& re m3.reserve(VectorXi::Constant(outer,int(inner/2))); for(Index j=0; j<outer; ++j) for(Index k=0; k<(std::min)(j,inner); ++k) - m3.insertByOuterInner(j,k) = k+1; + m3.insertByOuterInner(j,k) = internal::convert_index<StorageIndex>(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<typename MatrixType> void vectorwiseop_matrix(const MatrixType& m) Matrix<Scalar,1,MatrixType::RowsAtCompileTime> 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() |