fhelium.config.ckks
Define CKKS parameter presets and the validated configuration model.
Preset
class View source
Preset()Bases: Enum
Built-in CKKS parameter presets.
Each member name records the complex slot capacity, default scale bits, maximum public depth, and the Engine's selected residue dtype for its prime set. All baselines select the 128-bit classical security category, Gaussian error standard deviation 3.19, uniform-ternary secret sampling, and a ring-specific P-prime count. CkksConfig.parse accepts keyword overrides when an application needs a derived configuration.
Attributes
| Name | Type | Default/value |
|---|---|---|
slots8192_scale30_depth9_int64 | 'slots8192-scale30-depth9-int64' | |
slots8192_scale40_depth7_int64 | 'slots8192-scale40-depth7-int64' | |
slots8192_scale50_depth5_int64 | 'slots8192-scale50-depth5-int64' | |
slots16384_scale30_depth21_int64 | 'slots16384-scale30-depth21-int64' | |
slots16384_scale40_depth16_int64 | 'slots16384-scale40-depth16-int64' | |
slots16384_scale50_depth12_int64 | 'slots16384-scale50-depth12-int64' | |
slots32768_scale30_depth45_int64 | 'slots32768-scale30-depth45-int64' | |
slots32768_scale40_depth34_int64 | 'slots32768-scale40-depth34-int64' | |
slots32768_scale50_depth27_int64 | 'slots32768-scale50-depth27-int64' | |
slots32768_scale50_depth29_int64 | 'slots32768-scale50-depth29-int64' | |
slots65536_scale30_depth95_int64 | 'slots65536-scale30-depth95-int64' | |
slots65536_scale40_depth72_int64 | 'slots65536-scale40-depth72-int64' | |
slots65536_scale50_depth58_int64 | 'slots65536-scale50-depth58-int64' | |
slots8192_scale25_depth14_int32 | 'slots8192-scale25-depth14-int32' | |
slots16384_scale25_depth29_int32 | 'slots16384-scale25-depth29-int32' | |
slots32768_scale25_depth24_int32 | 'slots32768-scale25-depth24-int32' | |
slots65536_scale25_depth14_int32 | 'slots65536-scale25-depth14-int32' |
CkksConfig
class View source
CkksConfig(*, default_scale: float, q_depth_groups: tuple[tuple[int, ...], ...], p_moduli: tuple[int, ...], logN: int, sigma: float=3.19, security_bits: int=128, enforce_security_budget: bool=True, galois_generator: int=3)Immutable CKKS mathematical and security parameters.
The configuration defines CKKS over
q_depth_groups contains ordered Q groups. At depth d, the active Q basis is the concatenation of groups d:. A rescale removes group d and advances to d + 1. The last group is the terminal basis: max_depth == len(q_depth_groups) - 1 and no further rescale exists there. Depth identifies the active basis; it does not count multiplications or record how the value reached that basis.
p_moduli contains the special primes whose product is the key-switch modulus P. default_scale is used only when value creation omits a scale; every live plaintext and ciphertext carries its own actual scale. The Engine selects the residue dtype and Montgomery radix from these exact primes, and each device-local RNS context materializes the corresponding arithmetic tables.
parse
method
def parse(src: Mapping[str, Any] | Preset, **overrides: Any) -> 'CkksConfig': ...Resolve a preset or a serialized exact configuration.
dumps
method
def dumps() -> dict[str, object]: ...Return a versioned dictionary containing the exact parameter set.
N
property
N: intPolynomial ring dimension.
num_slots
property
num_slots: intNumber of complex CKKS slots,
max_depth
property
max_depth: intGreatest public CKKS depth represented by this Q chain.
depth_remaining
method
def depth_remaining(depth: int) -> int: ...Return the public rescale transitions remaining at depth.
q_moduli
property
q_moduli: tuple[int, ...]Q primes in depth-group and within-group order.
moduli
property
moduli: tuple[int, ...]Complete QP prime sequence used by RNS resources.
num_q_primes
property
num_q_primes: intNumber of prime rows in the complete Q chain.
num_p_primes
property
num_p_primes: intNumber of special-prime rows in P.
total_num_primes
property
total_num_primes: intNumber of prime rows in the complete QP basis.
rescale_divisor
method
def rescale_divisor(depth: int) -> int: ...Return the Q-group product removed at one public depth.
q_row_start
method
def q_row_start(depth: int) -> int: ...Return the first Q row active at depth.
active_q_moduli
method
def active_q_moduli(depth: int) -> tuple[int, ...]: ...Return the ordered Q primes active at depth.
inverse_ntt_scale
property
inverse_ntt_scale: tuple[int, ...]Return
total_modulus_bits
property
total_modulus_bits: intBit width of the complete QP product.
maximum_modulus_bits
property
maximum_modulus_bits: intBuilt-in complete-QP budget for the selected security category.
security_assessment
property
security_assessment: SecurityAssessmentReturn the built-in assessment of the complete QP product.
validate_security_budget
method
def validate_security_budget() -> SecurityAssessment: ...Require the complete QP product to meet the configured budget.