Improved the unit tests for setLinSpaced.

Provide a default constructed step size as opposed to an int when the size is 1.
This commit is contained in:
Hauke Heibel
2012-03-07 16:18:35 +01:00
parent ef022da28e
commit c08521ea6b
2 changed files with 9 additions and 5 deletions

View File

@@ -628,7 +628,7 @@ template <typename Scalar, bool RandomAccess> struct functor_traits< linspaced_o
template <typename Scalar, bool RandomAccess> struct linspaced_op
{
typedef typename packet_traits<Scalar>::type Packet;
linspaced_op(Scalar low, Scalar high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? 1 : (high-low)/(num_steps-1))) {}
linspaced_op(Scalar low, Scalar high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {}
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); }