Generator Operators¶
Generators provide a way to generate data on-the-fly without a tensor view as input. They are typically lower overhead than other operator types since their only purpose is to compute a single value at a particular location based on various inputs.
-
template<typename T = int, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::zeros(ShapeType &&s)¶ Return zero for all elements
Zeros is used as an operator that always returns a 0 type for all elements. It can be used in place of memset to zero a block of memory.
- Template Parameters
T – Data type
- Parameters
s – Shape of tensor
-
template<typename T = int, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::ones(ShapeType &&s)¶ Return one for all elements
Ones is used as an operator that always returns a 1 type for all elements. It can be used in place of memset to set all values to 1.
- Template Parameters
T – Data type
- Parameters
s – Shape of tensor
-
template<typename T = int, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::eye(ShapeType &&s)¶ Creates an identity patterns on the tensor
eye returns 1 on all elements on the diagonals of a tensor, and 0 otherwise. In other words, if the index of every dimension is the same, a 1 is returned, otherwise a zero is returned.
- Template Parameters
T – Data type
-
template<typename T = int, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::diag(ShapeType &&s, T val)¶ Creates a diagonal tensor with a given value on the diagonals
diag returns a given value on all elements on the diagonals of a tensor, and 0 otherwise. In other words, if the index of every dimension is the same, the value is returned, otherwise a zero is returned.
- Template Parameters
T – Data type
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hamming_x(ShapeType &&s)¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hamming_x(const index_t (&s)[RANK])¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hamming_y(ShapeType &&s)¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hamming_y(const index_t (&s)[RANK])¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hamming_w(ShapeType &&s)¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hamming_w(const index_t (&s)[RANK])¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hamming_z(ShapeType &&s)¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hamming_z(const index_t (&s)[RANK])¶ Creates a Hamming window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hamming window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape, can be deduced from shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hanning_x(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hanning_x(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hanning_y(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hanning_y(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hanning_w(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hanning_w(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::hanning_z(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::hanning_z(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::bartlett_x(ShapeType &&s)¶ Creates a Bartlett window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Bartlett window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::bartlett_x(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::bartlett_y(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::bartlett_y(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::bartlett_w(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::bartlett_w(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::bartlett_z(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::bartlett_z(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::blackman_x(ShapeType &&s)¶ Creates a Blackman window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Blackman window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::blackman_x(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::blackman_y(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::blackman_y(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::blackman_w(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::blackman_w(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::blackman_z(ShapeType &&s)¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, int RANK>
inline auto matx::blackman_z(const index_t (&s)[RANK])¶ Creates a Hanning window operator of shape s with the window applies along the x, y, z, or w dimension
Returns values for a Hanning window across the selected dimension.
- Template Parameters
T – Data type
RANK – The RANK of the shape
- Parameters
s – The shape of the tensor
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::range_x(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<typename T = float, int RANK>
inline auto matx::range_x(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
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::range_y(ShapeType &&s, T first, T step)¶ Create a range of values along the y 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<typename T = float, int RANK>
inline auto matx::range_y(const index_t (&s)[RANK], T first, T step)¶ Create a range of values along the y 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<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::range_w(ShapeType &&s, T first, T step)¶ Create a range of values along the w 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<typename T = float, int RANK>
inline auto matx::range_w(const index_t (&s)[RANK], T first, T step)¶ Create a range of values along the w 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<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::range_z(ShapeType &&s, T first, T step)¶ Create a range of values along the z 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<typename T = float, int RANK>
inline auto matx::range_z(const index_t (&s)[RANK], T first, T step)¶ Create a range of values along the z 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<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::linspace_x(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::linspace_x(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::linspace_y(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::linspace_y(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::linspace_w(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::linspace_w(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::linspace_z(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::linspace_z(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::logspace_x(ShapeType &&s, T first, T last)¶ Create a log-10-spaced range of values
Creates a set of values using a start and end that are log-10- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::logspace_x(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::logspace_y(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::logspace_y(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::logspace_w(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::logspace_w(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, typename ShapeType, std::enable_if_t<!std::is_array_v<typename remove_cvref<ShapeType>::type>, bool> = true>
inline auto matx::logspace_z(ShapeType &&s, T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.
-
template<typename T = float, int RANK>
inline auto matx::logspace_z(const index_t (&s)[RANK], T first, T last)¶ Create a linearly-spaced range of values
Creates a set of values using a start and end that are linearly- spaced apart over the set of values. Distance is determined by the shape and selected dimension.