arange

Returns a 1-dimensional slice whose elements are equal to its indices.

  1. auto arange(size_t size)
  2. auto arange(E start, E end, E step)
    pure
    arange
    (
    E
    )
    (,
    E end
    ,
    E step = 1
    )

Parameters

start E

value of the first index

end E

value of the last index

step E

value between indices (default = 1)

Return Value

Type: auto

1-dimensional slice composed of indices

Examples

assert(arange(3) == [0, 1, 2]);
assert(arange(2, 3, 0.3) == [2.0, 2.3, 2.6, 2.9]);

Meta