range#

Return a range of numbers using a start and step value. The total length is based on the shape

template<int Dim, typename ShapeType, typename T = float, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::range(ShapeType &&s, T first, T step)#

Create a range of values along the x dimension

Creates a range of values of type T with a start and step size. Value is determined by the index in operator()

Parameters:
  • s – Tensor shape

  • first – Starting value

  • step – Step size

template<int Dim, int RANK, typename T = float>
inline auto matx::range(const index_t (&s)[RANK], T first, T step)#

Create a range of values along the x dimension

Creates a range of values of type T with a start and step size. Value is determined by the index in operator()

Parameters:
  • s – Tensor shape

  • first – Starting value

  • step – Step size

Examples#

index_t count = 100;
tensor_t<TestType, 1> t1{{count}};

// Generate a sequence of 100 numbers starting at 1 and spaced by 1
(t1 = range<0>(t1.Shape(), 1, 1)).run(exec);