fhelium.backend.ckks.materialization
Prepare one device's CKKS numerical tables and sampling state.
CkksDeviceResources
class View source
CkksDeviceResources(*, config: CkksConfig, device: str | torch.device, rns_layout: RnsLayout | None=None, ntt_backend: str | None=None, rng_seed: int | None=None, rng_nonce: int | None=None, rns_dtype: torch.dtype | None=None)Own lazily constructed CKKS resources for one concrete device.
The default RNS layout follows the configuration's Q depth groups and hybrid decomposition. Callers can supply an existing layout for reuse.
rns_context
property
rns_context: RnsContextReturn the device's RNS arithmetic context.
ntt_context
property
ntt_context: NttContextReturn the NTT context composed with this device's RNS context.
rng
property
rng: CsprngReturn the stateful random stream assigned to this device.
key_generation
property
key_generation: KeyGenerationResourceReturn the resources used to generate keys on this device.
periodic_encode_operands
method
def periodic_encode_operands(period: int, depth: int, basis: str): ...Return compact tables and the existing live rounding stream.
encode_operands
method
def encode_operands() -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: ...Return the inverse-embedding permutation, twister, and live rounding state.
decode_operands
method
def decode_operands() -> tuple[torch.Tensor, torch.Tensor]: ...Return the coefficient-embedding permutation and skewer.
key_switch_operands
method
def key_switch_operands(depth: int) -> tuple[dict[str, torch.Tensor], dict[str, object]]: ...Prepare Tensor views and digit ranges for a hybrid key switch.
rescale_operands
method
def rescale_operands(row_count: int, drop_count: int, *, include_p: bool=False, input_domain: str='coefficient') -> tuple[dict[str, torch.Tensor], dict[str, object]]: ...Prepare quotient and transform tables for one rescale group.
reconstruction_operands
method
def reconstruction_operands(depth: int) -> tuple[torch.Tensor, ...]: ...Prepare Q parameters and centered mixed-radix reconstruction tables.
bindings
property
bindings: ResourceBindingsReturn this device's bindable random-stream execution resource.
materialize
method
def materialize(requirements: tuple[ResourceRequirement, ...], /) -> ResourceBindings: ...Return all constructible missing resources in one batch.