Columns
In S-two, the computation trace is represented using multiple columns, each containing elements from the Mersenne prime field . The columns are defined via theColumn<T> trait, where T is typically BaseField (an alias for M31).
ColumnOps<T> trait, which also implements the type alias Col<B, T> to conveniently represent a column.
S-two defines a
Backend trait, with two main implementations: CpuBackend and SimdBackend. The SimdBackend offers optimized routines for hardware supporting SIMD instructions, while CpuBackend provides a straightforward reference implementation.Each backend implements the ColumnOps trait. Here and in the following sections, we will describe the trait implementations for the CpuBackend.ColumnOps<T> trait is implemented for the CpuBackend as follows:
bit_reverse performs a naive bit-reversal permutation on the column.
Secure Field Columns
An element of the secure field (SecureField = QM31) cannot be stored in a single BaseField column because it is a quartic extension of M31. Instead, each secure field element is represented by four base field coordinates and stored in four consecutive columns.
SECURE_EXTENSION_DEGREE is the extension degree of QM31 i.e. 4. You can think of each row of the 4 columns containing a single element of the SecureField. Thus accessing an element by index reconstructs it from its base field coordinates, implemented as follows: