mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-03 11:45:12 +08:00
* fix a couple of warnings (patch from Armin Berres)
* allow Map to map null data
This commit is contained in:
parent
5015e48361
commit
1ed17b037d
@ -58,7 +58,7 @@ struct IOFormat
|
||||
coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags)
|
||||
{
|
||||
rowSpacer = "";
|
||||
int i=matSuffix.length()-1;
|
||||
int i = int(matSuffix.length())-1;
|
||||
while (i>=0 && matSuffix[i]!='\n')
|
||||
{
|
||||
rowSpacer += ' ';
|
||||
@ -135,7 +135,7 @@ std::ostream & ei_print_matrix(std::ostream & s, const MatrixBase<Derived> & _m,
|
||||
std::stringstream sstr;
|
||||
sstr.precision(fmt.precision);
|
||||
sstr << m.coeff(i,j);
|
||||
width = std::max<int>(width, sstr.str().length());
|
||||
width = std::max<int>(width, int(sstr.str().length()));
|
||||
}
|
||||
}
|
||||
s.precision(fmt.precision);
|
||||
|
@ -138,15 +138,16 @@ template<typename Derived> class MapBase
|
||||
m_cols(ColsAtCompileTime == Dynamic ? size : ColsAtCompileTime)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
ei_assert(size > 0);
|
||||
ei_assert(size > 0 || data == 0);
|
||||
ei_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size);
|
||||
}
|
||||
|
||||
inline MapBase(const Scalar* data, int rows, int cols)
|
||||
: m_data(data), m_rows(rows), m_cols(cols)
|
||||
{
|
||||
ei_assert(rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
|
||||
&& cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
|
||||
ei_assert( (data == 0)
|
||||
|| ( rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
|
||||
&& cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)));
|
||||
}
|
||||
|
||||
template<typename OtherDerived>
|
||||
|
@ -51,7 +51,7 @@ inline int ei_sin(int) { ei_assert(false); return 0; }
|
||||
inline int ei_cos(int) { ei_assert(false); return 0; }
|
||||
|
||||
#if EIGEN_GNUC_AT_LEAST(4,3)
|
||||
inline int ei_pow(int x, int y) { return std::pow(x, y); }
|
||||
inline int ei_pow(int x, int y) { return int(std::pow(x, y)); }
|
||||
#else
|
||||
inline int ei_pow(int x, int y) { return int(std::pow(double(x), y)); }
|
||||
#endif
|
||||
@ -103,7 +103,7 @@ template<> inline float ei_random(float a, float b)
|
||||
} while(i==0);
|
||||
return i/256.f;
|
||||
#else
|
||||
return a + (b-a) * std::rand() / RAND_MAX;
|
||||
return a + (b-a) * float(std::rand()) / float(RAND_MAX);
|
||||
#endif
|
||||
}
|
||||
template<> inline float ei_random()
|
||||
@ -254,7 +254,7 @@ inline long double ei_pow(long double x, long double y) { return std::pow(x, y)
|
||||
|
||||
template<> inline long double ei_random(long double a, long double b)
|
||||
{
|
||||
return ei_random<double>(a,b);
|
||||
return static_cast<long double>(ei_random<double>(a,b));
|
||||
}
|
||||
template<> inline long double ei_random()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user