mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-23 21:34:30 +08:00
Fix various scalar type conversion warnings.
This commit is contained in:
parent
61c3f55362
commit
7ee378d89d
@ -525,8 +525,8 @@ struct solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
|
|||||||
{
|
{
|
||||||
eigen_assert(rhs().rows() == dec().rows());
|
eigen_assert(rhs().rows() == dec().rows());
|
||||||
|
|
||||||
const int cols = dec().cols(),
|
const Index cols = dec().cols(),
|
||||||
nonzero_pivots = dec().nonzeroPivots();
|
nonzero_pivots = dec().nonzeroPivots();
|
||||||
|
|
||||||
if(nonzero_pivots == 0)
|
if(nonzero_pivots == 0)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ void SparseLUImpl<Scalar,Index>::pruneL(const Index jcol, const IndexVector& per
|
|||||||
Index jsupno = glu.supno(jcol);
|
Index jsupno = glu.supno(jcol);
|
||||||
Index i,irep,irep1;
|
Index i,irep,irep1;
|
||||||
bool movnum, do_prune = false;
|
bool movnum, do_prune = false;
|
||||||
Index kmin, kmax, minloc, maxloc,krow;
|
Index kmin = 0, kmax = 0, minloc, maxloc,krow;
|
||||||
for (i = 0; i < nseg; i++)
|
for (i = 0; i < nseg; i++)
|
||||||
{
|
{
|
||||||
irep = segrep(i);
|
irep = segrep(i);
|
||||||
|
@ -32,7 +32,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>M_PI)
|
if(theta_tot>M_PI)
|
||||||
theta_tot = Scalar(2.*M_PI)-theta_tot;
|
theta_tot = Scalar(2.*M_PI)-theta_tot;
|
||||||
for(Scalar t=0; t<=1.001; t+=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);
|
||||||
Scalar theta = AA(q*q0.inverse()).angle();
|
Scalar theta = AA(q*q0.inverse()).angle();
|
||||||
@ -156,7 +156,7 @@ template<typename Scalar, int Options> void quaternion(void)
|
|||||||
check_slerp(q1,q2);
|
check_slerp(q1,q2);
|
||||||
|
|
||||||
q1 = AngleAxisx(b, v1.normalized());
|
q1 = AngleAxisx(b, v1.normalized());
|
||||||
q2 = AngleAxisx(b+M_PI, v1.normalized());
|
q2 = AngleAxisx(b+Scalar(M_PI), v1.normalized());
|
||||||
check_slerp(q1,q2);
|
check_slerp(q1,q2);
|
||||||
|
|
||||||
q1 = AngleAxisx(b, v1.normalized());
|
q1 = AngleAxisx(b, v1.normalized());
|
||||||
|
@ -13,7 +13,7 @@ template<typename MatrixType> void verifySizeOf(const MatrixType&)
|
|||||||
{
|
{
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
if (MatrixType::RowsAtCompileTime!=Dynamic && MatrixType::ColsAtCompileTime!=Dynamic)
|
if (MatrixType::RowsAtCompileTime!=Dynamic && MatrixType::ColsAtCompileTime!=Dynamic)
|
||||||
VERIFY(sizeof(MatrixType)==sizeof(Scalar)*std::ptrdiff_t(MatrixType::SizeAtCompileTime));
|
VERIFY(std::ptrdiff_t(sizeof(MatrixType))==std::ptrdiff_t(sizeof(Scalar))*std::ptrdiff_t(MatrixType::SizeAtCompileTime));
|
||||||
else
|
else
|
||||||
VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index));
|
VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index));
|
||||||
}
|
}
|
||||||
|
@ -66,10 +66,10 @@ initSparse(double density,
|
|||||||
//sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));
|
//sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));
|
||||||
sparseMat.reserve(VectorXi::Constant(IsRowMajor ? refMat.rows() : refMat.cols(), int((1.5*density)*(IsRowMajor?refMat.cols():refMat.rows()))));
|
sparseMat.reserve(VectorXi::Constant(IsRowMajor ? refMat.rows() : refMat.cols(), int((1.5*density)*(IsRowMajor?refMat.cols():refMat.rows()))));
|
||||||
|
|
||||||
for(int j=0; j<sparseMat.outerSize(); j++)
|
for(Index j=0; j<sparseMat.outerSize(); j++)
|
||||||
{
|
{
|
||||||
//sparseMat.startVec(j);
|
//sparseMat.startVec(j);
|
||||||
for(int i=0; i<sparseMat.innerSize(); i++)
|
for(Index i=0; i<sparseMat.innerSize(); i++)
|
||||||
{
|
{
|
||||||
int ai(i), aj(j);
|
int ai(i), aj(j);
|
||||||
if(IsRowMajor)
|
if(IsRowMajor)
|
||||||
|
@ -449,12 +449,12 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
|||||||
|
|
||||||
// test conservative resize
|
// test conservative resize
|
||||||
{
|
{
|
||||||
std::vector< std::pair<int,int> > inc;
|
std::vector< std::pair<Index,Index> > inc;
|
||||||
inc.push_back(std::pair<int,int>(-3,-2));
|
inc.push_back(std::pair<Index,Index>(-3,-2));
|
||||||
inc.push_back(std::pair<int,int>(0,0));
|
inc.push_back(std::pair<Index,Index>(0,0));
|
||||||
inc.push_back(std::pair<int,int>(3,2));
|
inc.push_back(std::pair<Index,Index>(3,2));
|
||||||
inc.push_back(std::pair<int,int>(3,0));
|
inc.push_back(std::pair<Index,Index>(3,0));
|
||||||
inc.push_back(std::pair<int,int>(0,3));
|
inc.push_back(std::pair<Index,Index>(0,3));
|
||||||
|
|
||||||
for(size_t i = 0; i< inc.size(); i++) {
|
for(size_t i = 0; i< inc.size(); i++) {
|
||||||
Index incRows = inc[i].first;
|
Index incRows = inc[i].first;
|
||||||
@ -472,9 +472,9 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
|||||||
|
|
||||||
// Insert new values
|
// Insert new values
|
||||||
if (incRows > 0)
|
if (incRows > 0)
|
||||||
m1.insert(refMat1.rows()-1, 0) = refMat1(refMat1.rows()-1, 0) = 1;
|
m1.insert(m1.rows()-1, 0) = refMat1(refMat1.rows()-1, 0) = 1;
|
||||||
if (incCols > 0)
|
if (incCols > 0)
|
||||||
m1.insert(0, refMat1.cols()-1) = refMat1(0, refMat1.cols()-1) = 1;
|
m1.insert(0, m1.cols()-1) = refMat1(0, refMat1.cols()-1) = 1;
|
||||||
|
|
||||||
VERIFY_IS_APPROX(m1, refMat1);
|
VERIFY_IS_APPROX(m1, refMat1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user