mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-22 09:39:34 +08:00
Fix some conversion warnings in unit tests.
This commit is contained in:
parent
fdcad686ee
commit
db62719eda
@ -31,7 +31,7 @@ template<typename QuatType> void check_slerp(const QuatType& q0, const QuatType&
|
|||||||
|
|
||||||
Scalar theta_tot = AA(q1*q0.inverse()).angle();
|
Scalar theta_tot = AA(q1*q0.inverse()).angle();
|
||||||
if(theta_tot>Scalar(EIGEN_PI))
|
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))
|
for(Scalar t=0; t<=Scalar(1.001); t+=Scalar(0.1))
|
||||||
{
|
{
|
||||||
QuatType q = q0.slerp(t,q1);
|
QuatType q = q0.slerp(t,q1);
|
||||||
|
@ -17,6 +17,7 @@ template<typename SparseMatrixType> void sparse_block(const SparseMatrixType& re
|
|||||||
const Index outer = ref.outerSize();
|
const Index outer = ref.outerSize();
|
||||||
|
|
||||||
typedef typename SparseMatrixType::Scalar Scalar;
|
typedef typename SparseMatrixType::Scalar Scalar;
|
||||||
|
typedef typename SparseMatrixType::StorageIndex StorageIndex;
|
||||||
|
|
||||||
double density = (std::max)(8./(rows*cols), 0.01);
|
double density = (std::max)(8./(rows*cols), 0.01);
|
||||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
|
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)));
|
m3.reserve(VectorXi::Constant(outer,int(inner/2)));
|
||||||
for(Index j=0; j<outer; ++j)
|
for(Index j=0; j<outer; ++j)
|
||||||
for(Index k=0; k<(std::min)(j,inner); ++k)
|
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)
|
for(Index j=0; j<(std::min)(outer, inner); ++j)
|
||||||
{
|
{
|
||||||
VERIFY(j==numext::real(m3.innerVector(j).nonZeros()));
|
VERIFY(j==numext::real(m3.innerVector(j).nonZeros()));
|
||||||
|
@ -233,10 +233,10 @@ template<typename MatrixType> void vectorwiseop_matrix(const MatrixType& m)
|
|||||||
Matrix<Scalar,1,MatrixType::RowsAtCompileTime> tmp(rows);
|
Matrix<Scalar,1,MatrixType::RowsAtCompileTime> tmp(rows);
|
||||||
VERIFY_EVALUATION_COUNT( tmp = (m1 * m1.transpose()).colwise().sum(), (MatrixType::RowsAtCompileTime==Dynamic ? 1 : 0));
|
VERIFY_EVALUATION_COUNT( tmp = (m1 * m1.transpose()).colwise().sum(), (MatrixType::RowsAtCompileTime==Dynamic ? 1 : 0));
|
||||||
|
|
||||||
m2 = m1.rowwise() - (m1.colwise().sum()/m1.rows()).eval();
|
m2 = m1.rowwise() - (m1.colwise().sum()/RealScalar(m1.rows())).eval();
|
||||||
m1 = m1.rowwise() - (m1.colwise().sum()/m1.rows());
|
m1 = m1.rowwise() - (m1.colwise().sum()/RealScalar(m1.rows()));
|
||||||
VERIFY_IS_APPROX( m1, m2 );
|
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()
|
void test_vectorwiseop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user