rotation_vec

Vector rotation.

Namespace: dsp

Prototype

Vector<T> rotation_vec(const Vector<T> &x, int d)

Parameters

xInput column vector
dInteger number of steps (positive or negative)

Returns

Data vector with rtation of \(d\) steps (modulo the vector dimension): \[ y_k = x_{k + d\ [N]} \]\(N\) being the vector length.

Description

Example

let x     = linspace(0, 5, 6),
    y     = rotation_vec(x, 2),
    yref  = Vecf::values({2, 3, 4, 5, 0, 1});

assertion(y.isApprox(yref));