This section covers the implementation of theDocumentation Index
Fetch the complete documentation index at: https://docs.starknet.io/llms.txt
Use this file to discover all available pages before exploring further.
interpolate function step by step. The function takes as input a CircleEvaluation and a TwiddleTree and outputs a CirclePoly.
The circle FFT algorithm changes the order of the input. Since the CircleEvaluation is in BitReversedOrder, the output coefficients of the CirclePoly will be in NaturalOrder. The complete implementation of the interpolate function is shown below:
-
Compute Twiddles: Given the
TwiddleTree, the function computes the line twiddles and circle twiddles.-
The
circle_twiddlesare twiddles required at the first layer where all points are projected to the -axis. These correspond to the -coordinate points in the half coset. -
The
line_twiddlesare twiddles required to compute FFT at the subsequent recursive layers where the squaring map is used as the 2-to-1 map.
For the example of the half coset, there are three FFT layers: one layer with the projection map and two recursive layers with the squaring map . The
Theline_twiddlesfor the two recursive layers are computed using the inverse twiddles . For the first recursive layer, the twiddles are the inverse of the -coordinates: . For the second recursive layer, the twiddles are the inverse of the square of the -coordinates: . Thus for this example, theline_twiddlesare .circle_twiddlesare computed using the first recursive layerline_twiddles. They are equal to the inverse of the -coordinates of the half coset.For this example, they take the values .
-
The
-
Apply FFT Layers: With the twiddles for each layer computed, the FFT algorithm is applied first using the projection map and
circle_twiddles, then using the squaring map and theline_twiddles. This process uses two key functions:-
fft_layer_loop: Applies butterfly operations across a specific layer of the FFT. The key inputs are the values array, layer parameters, twiddle factor, and the butterfly function to apply. It iterates through pairs of elements in the values array at the appropriate indices and applies the butterfly operation with the twiddle factor. -
ibutterfly: Performs the inverse butterfly operation on a pair of elements from the values array. This is the fundamental operation that transforms the values during interpolation.
-
-
Scale and Output: Finally, the
valuesare scaled by dividing by the domain size, and theCirclePolyis output.
interpolate function. The evaluate function follows a similar approach, applying the same components in reverse order to convert from coefficient representation back to point-value representation. In the next section, we will explore the FFT basis underlying the Circle FFT algorithm.