warp.tile\_arange ================= .. currentmodule:: warp._src.lang .. function:: tile_arange(*args: Scalar, dtype: Scalar = ..., storage: str = "register") -> Tile[float32, tuple[int]] .. wp-function-tags:: :kernel: true :python: false :differentiable: false Generate a 1D tile of linearly spaced elements. The range follows the half-open interval ``[start, stop)`` and holds ``ceil((stop - start) / step)`` elements. For example, ``tile_arange(0, 10, 3)`` yields ``[0, 3, 6, 9]``. The interval excludes ``stop``, except when ``step`` is non-integral and floating-point round-off affects the number of elements. The range is interpreted at the output element type: each argument must be representable there, so an integer ``dtype`` rejects a fractional bound, and a floating-point range is counted from its rounded values rather than from the wider ones it was written as. A zero ``step`` raises an error, as does a range spanning no elements, such as ``tile_arange(5, 5)`` or ``tile_arange(0, 10, -1)``, because zero-length tile dimensions are not supported. :param args: Positional compile-time constants specifying the range: - ``(stop,)``: Use ``0`` for ``start`` and ``1`` for ``step``. - ``(start, stop)``: Use ``1`` for ``step``. - ``(start, stop, step)``: Use the supplied ``start``, ``stop``, and ``step``. :param dtype: Data type of output tile's elements. Defaults to ``float`` even when the range arguments are integers; pass ``dtype=int`` for an integer tile. Must be a compile-time constant and a numeric scalar type. :param storage: The storage location for the tile: ``"register"`` for registers or ``"shared"`` for shared memory. Must be a compile-time constant. :returns: A tile with ``shape=(n,)`` holding the linearly spaced elements. .. rubric:: Example .. testcode:: @wp.kernel def store_ranges(out: wp.array[int]): a = wp.tile_arange(4, dtype=int) b = wp.tile_arange(9, 0, -3, dtype=int) wp.tile_store(out, a) wp.tile_store(out, b, offset=(4,)) out = wp.zeros(7, dtype=int) wp.launch_tiled(store_ranges, dim=1, outputs=[out], block_dim=4) print(out.numpy()) .. testoutput:: [0 1 2 3 9 6 3]