pub const fn first_row_to_first_col<const N: usize, T: Copy>(
v: &[T; N],
) -> [T; N]
Expand description
Given the first row of a circulant matrix, return the first column.
For example if, v = [0, 1, 2, 3, 4, 5]
then output = [0, 5, 4, 3, 2, 1]
,
i.e. the first element is the same and the other elements are reversed.
This is useful to prepare a circulant matrix for input to an FFT algorithm, which expects the first column of the matrix rather than the first row (as we normally store them).
NB: The algorithm is inefficient but simple enough that this
function can be declared const
, and that is the intended context
for use.