fhelium.native.tables
Positional table operands of the whole native operations.
A whole native operation receives each table family as one Tensor?[] argument. The slot order is the field order of the family's table struct in fhelium/operation_tables.h and is reported by the table_slot_names operator; an absent table is None. Families with digit groups (key_switch and encapsulation) append one group of digit{i}_ slots per key-switching digit.
digit_count
function View source
def digit_count(names: Iterable[str], prefix: str='') -> int: ...Return the number of {prefix}digit{i}_ groups among names.
galois_tables
function View source
def galois_tables(ring_dimension: int, galois_element: int, device: torch.device | str) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: ...Build the tables of
The tables are (ntt_indices, coefficient_indices, coefficient_signs) with shape [N]: the gather of bit-reversed NTT evaluations (int32), and the coefficient gather (int32) with its signs (int8), so that coefficient coefficient_signs[j] * a[coefficient_indices[j]]. Every call builds new Tensors on device through fhelium_ckks_ops::galois_table_set; fhelium.backend.ckks.materialization.CkksDeviceResources.galois_tables keeps one set per element for a device.
named_slots
function View source
def named_slots(family: str, names: Iterable[str], values: Iterable[torch.Tensor], **options: object) -> list[torch.Tensor | None]: ...Order parallel names and values into the slots of family.
slot_names
function View source
def slot_names(family: str, digit_count: int=0) -> tuple[str, ...]: ...Return the positional slot names of one table family.
table_slots
function View source
def table_slots(family: str, tables: Mapping[str, torch.Tensor], *, prefix: str='', digits: int | None=None) -> list[torch.Tensor | None]: ...Order named tables into the positional slots of family.
prefix selects the names of one NTT basis or direction, such as q_forward_ for the ntt family. The digit-group count is read from the names unless digits is given.