aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Functors.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/Functors.h')
-rw-r--r--Eigen/src/Core/Functors.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h
index cbda77c2d..1d641b19f 100644
--- a/Eigen/src/Core/Functors.h
+++ b/Eigen/src/Core/Functors.h
@@ -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(low, (high-low)/(num_steps-1)) {}
+ linspaced_op(Scalar low, Scalar high, int num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? 1 : (high-low)/(num_steps-1))) {}
template<typename Index>
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); }