A very common operation is to create an integer vector with a uniform spacing between neighboring elements; for example, [1 2 3 4], [-1 2 5 8], etc. Currently this is cumbersome to do in runtime (i.e., when the string notation, "-1:3:8" is unsuitable because the starting or ending value is determined at runtime).
Therefore it would be useful with an integer equivalent to linspace. Attached is a patch file that implements an integer linspace function with the following syntax:
ivec linspace_i(int from, int length, int spacing = 1);
Log in to post a comment.