Question about Chebyshev Coefficients in CKKS Bootstrapping

Hi everyone,

I’m trying to understand the exact function approximated by the Chebyshev series in CKKS bootstrapping, but I’m encountering a discrepancy between the precomputed coefficients in OpenFHE and the ones I calculate myself.

Context

In the EvalBootstrap function, specifically in the FULLY PACKED CASE with cryptoParams->GetSecretKeyDist() == SPARSE_TERNARY:

  • The code sets k = 1.0 (since it mentions “do not divide by k as we already did it during precomputation”)

  • It uses coefficients = g_coefficientsSparse

  • The coefficients array has 45 elements (degree 44 Chebyshev polynomial)

My Understanding

Based on the code, I believe the function being approximated should be:

f(x) = sin(2πkx)/(2π) = sin(2πx)/(2π)  (since k=1.0)

The Problem

When I compute the Chebyshev coefficients for this function using EvalChebyshevCoefficients over the interval [-1, 1] with degree 44, I get completely different coefficients:

My computed coefficients (first few shown):

coefficients[ 0] =  3.098408875147464e-18
coefficients[ 1] = -6.760345897603455e-02
coefficients[ 2] =  5.633032620602465e-18
coefficients[ 3] = -9.266699807816201e-03
coefficients[ 4] = -3.720018120705820e-18
coefficients[ 5] =  1.186737744444545e-01
...

OpenFHE’s g_coefficientsSparse (first few shown):

cpp

-0.18646470117093214,   0.036680543700430925,  -0.20323558926782626,
 0.029327390306199311, -0.24346234149506416,   0.011710240188138248,
...

Key Observations

  1. My coefficients have near-zero even-indexed values (as expected for an odd function like sin)

  2. OpenFHE’s coefficients have significant values at all indices

  3. The magnitude and pattern are completely different

Questions

  1. What is the actual function that EvalBootstrap approximates(not only for sparse ternary key but also for uniform ternary key)?

  2. Is there a scaling factor or transformation I’m missing?

  3. Why k and the sin(x) function to approximate for sparse ternary key and uniform ternary key are different?

Any clarification would be greatly appreciated! I’m trying to understand the mathematical foundation of the bootstrapping process better.

Thank you!

For precision reasons, we do not directly evaluate the sine function, but use several iterations of the double angle formula. Please see this response and the reference cited there.