Front-end
ScalarZnx
One polynomial
Backend representation
SvpPPol- The scalar prepared for repeated scalar–vector products.
Layouts and operations
For readers exploring the arithmetic internals: polynomial layouts, their products, and key switching. These polynomial vectors implement cryptographic operations; they are distinct from the numerical slot vectors in CKKS.
Explore the layouts ↓01 / Layouts and products
Each square is one polynomial with N coefficients in ℤ[X]/(Xᴺ + 1). Group squares into a vector, then stack vectors into a matrix.
Front-end
One polynomial
Backend representation
SvpPPolFront-end
A vector of polynomials
Backend representations
VecZnxDftVecZnxBigFront-end
Each row is a VecZnx
Backend representation
VmpPMatBase 2ᴷ / Signed limbs
K = base2k sets the digit width, not the machine-word size. Storage can leave headroom for additions.
Three polynomial limbs; values are taken modulo 1.
Each square still contains N coefficients. Its position supplies the weight 2−Ki.
One coefficient across three limbs · K = 4 · base 16.
19 = 3 + 1 × 16: keep 3, carry 1 to the left. The value stays the same.
Scale each vⱼ by s.
Each cⱼ is the dot product of v with column j of M.
Conservative capacity estimate≈ 2K + ⌈log₂ N⌉ bitsFor one product of two polynomial limbs with K-bit signed coefficients. Summing r products adds up to ⌈log₂ r⌉ bits. Signed terms usually cancel, so typical magnitudes are much smaller.
From products back to digitsVecZnxDft supports the computation using the backend’s FFT precision or NTT range. IDFT writes wide VecZnxBig coefficients; normalization carries them back into K-bit signed limbs in VecZnx.
02 / Data lifecycle
Front-end layouts hold signed base-2ᴷ limbs. Backend layouts hold prepared operands, transformed vectors, and wide accumulators.
Backends can customize all seven layouts, especially the backend-specific types such as VmpPMat.
Prepare ScalarZnx once, then reuse SvpPPol across scalar-vector products. svp_apply_dft also accepts VecZnx directly; the graph makes the transform stage explicit.
Prepare MatZnx once, then reuse VmpPMat across vector-matrix products. vmp_apply_dft also accepts VecZnx directly; the graph makes the transform stage explicit.
Arrows describe data flow into output buffers, not ownership moves. Prepared operands remain reusable; IDFT variants may use the transform input as scratch.
03 / VMP in practice
Key switching is a VMP followed by body addition and normalization. Multiply the mask by the key-switching matrix, then add the original body. The message stays the same; the secret changes from s0 to s1.
K = base2k bits per signed limb · three mask limbs · three key rows · five limbs per column, including error padding.
Limb weights. The mask decomposes as a = Σᵢ aᵢgᵢ, with gᵢ = 2−Ki and K = base2k bits per limb. Each key row encrypts gᵢs0 under s1, so their weighted sum encrypts as0. Placing s0 in limb i supplies this weight implicitly.
Coefficient magnitude. Bar heights show relative norms. Multiplication by a uniform mask limb scales both payload and error. Transformed states show these logical contributions; heights are schematic, not measured bounds.