LinSpaced for integer types
Submitted by Christoph Hertzberg @chhtz
Assigned to Nobody
Link to original bugzilla bug (#698)
Version: 3.4 (development)
Description
At the moment, e.g., Vector4i::LinSpaced(0,5) results in {0 1 2 3} which is unlikely to be intended. The reason is that inside LinSpaced a stepsize is calculated which gets truncated for integer types.
I would suggest to specify LinSpaced(size, low, high)[i] always as
low + (high-low)i/(size-1);
(that is for size>1, for size==1 see bug #224 (closed)).
The implementation can then be optimized as low + i((high-low)/(size-1)) for float-types and some kind of Bresenham algorithm for integer types.
We also need unit tests for LinSpaced on integer types.
Blocking
Edited by Eigen Bugzilla