found one bug in the previous ++ changes

This commit is contained in:
Gael Guennebaud 2008-12-17 16:04:21 +00:00
parent 89f468671d
commit e3a8431a4a
2 changed files with 5 additions and 5 deletions

View File

@ -27,13 +27,13 @@
#define EIGEN_COMMAINITIALIZER_H #define EIGEN_COMMAINITIALIZER_H
/** \class CommaInitializer /** \class CommaInitializer
* *
* \brief Helper class used by the comma initializer operator * \brief Helper class used by the comma initializer operator
* *
* This class is internally used to implement the comma initializer feature. It is * This class is internally used to implement the comma initializer feature. It is
* the return type of MatrixBase::operator<<, and most of the time this is the only * the return type of MatrixBase::operator<<, and most of the time this is the only
* way it is used. * way it is used.
* *
* \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() * \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished()
*/ */
template<typename MatrixType> template<typename MatrixType>
@ -67,7 +67,7 @@ struct CommaInitializer
ei_assert(m_col<m_matrix.cols() ei_assert(m_col<m_matrix.cols()
&& "Too many coefficients passed to comma initializer (operator<<)"); && "Too many coefficients passed to comma initializer (operator<<)");
ei_assert(m_currentBlockRows==1); ei_assert(m_currentBlockRows==1);
m_matrix.coeffRef(m_row, ++m_col) = s; m_matrix.coeffRef(m_row, m_col++) = s;
return *this; return *this;
} }
@ -128,7 +128,7 @@ struct CommaInitializer
* *
* Example: \include MatrixBase_set.cpp * Example: \include MatrixBase_set.cpp
* Output: \verbinclude MatrixBase_set.out * Output: \verbinclude MatrixBase_set.out
* *
* \sa CommaInitializer::finished(), class CommaInitializer * \sa CommaInitializer::finished(), class CommaInitializer
*/ */
template<typename Derived> template<typename Derived>

View File

@ -101,7 +101,7 @@ template<> inline float ei_random(float a, float b)
int i; int i;
do { i = ei_random<int>(256*int(a),256*int(b)); do { i = ei_random<int>(256*int(a),256*int(b));
} while(i==0); } while(i==0);
return i/256.f; return float(i)/256.f;
#else #else
return a + (b-a) * float(std::rand()) / float(RAND_MAX); return a + (b-a) * float(std::rand()) / float(RAND_MAX);
#endif #endif