linspace#
Return a range of linearly-spaced numbers using first and last value. The step size is determined by the count parameter. axis (either 0 or 1) can be used to make the increasing sequence along the specified axis.
-
template<typename T = float>
inline auto matx::linspace(T first, T last, index_t count, int axis = 0)# Create a linearly-spaced vector of values.
Creates a set of values using startsand stop that are linearly- spaced apart over the set of values. Distance is determined by the count parameter
- Template Parameters:
T – Type of the values
- Parameters:
first – First value
last – Last value
count – Number of values in a row or column, depending on the axis
axis – Axis to operate over
- Returns:
Operator with linearly-spaced values
-
template<int NUM_RC, typename T = float>
inline auto matx::linspace(const T (&firsts)[NUM_RC], const T (&lasts)[NUM_RC], index_t count, int axis = 0)# Create a matrix linearly-spaced range of values.
Creates a set of values using starts and stops that are linearly- spaced apart over the set of values. Distance is determined by the count parameter
- Template Parameters:
NUM_RC – Number of rows or columns, depending on the axis
T – Type of the values
- Parameters:
firsts – First values
lasts – Last values
count – Number of values in a row or column, depending on the axis
axis – Axis to operate over
- Returns:
Operator with linearly-spaced values
Examples#
index_t count = 100;
auto t1 = make_tensor<TestType>({count});
// Create a set of linearly-spaced numbers starting at 1, ending at 100, and
// with `count` points in between
(t1 = linspace((TestType)1, (TestType)100, count)).run(exec);