Skip to main content

transpose_square_blocks

Function transpose_square_blocks 

Source
pub fn transpose_square_blocks<P: PackedField>(log_n: usize, elems: &mut [P])
Expand description

Transpose square blocks of elements within packed field elements in place.

The input elements are interpreted as a rectangular matrix with height n = 2^n in row-major order. This matrix is interpreted as a vector of square matrices of field elements, and each square matrix is transposed in-place.

§Arguments

  • log_n: The base-2 logarithm of the dimension of the n x n square matrix. Must be less than or equal to the base-2 logarithm of the packing width.
  • elems: The packed field elements, length is a power-of-two multiple of 1 << log_n.

§Preconditions

  • log_n must be at most P::LOG_WIDTH.
  • elems.len() must be a power of two and at least 2^log_n.

A caller whose dimensions are compile-time constants should use the fixed-size form below. That form unrolls the butterfly and keeps the array in registers.