alternate

alternate#

Generate an alternating sequence of +1, -1, +1, …

template<typename T = float>
inline auto matx::alternate(const index_t len)#

Creates an alternating +1/-1 sequence

Template Parameters:

T – Data type

Parameters:

len – Length of sequence

Examples#

auto td = make_tensor<TestType>({10});

// td contains the sequence 1, -1, 1, -1, 1, -1, 1, -1, 1, -1
(td = alternate(10)).run(exec);