fhelium.backend.ntt.tables
Typed, family-specific NTT table materialization.
IndexedRadix2Tables
class View source
IndexedRadix2Tables(forward_even_indices: torch.Tensor, forward_odd_indices: torch.Tensor, forward_twiddles: torch.Tensor, inverse_even_indices: torch.Tensor, inverse_odd_indices: torch.Tensor, inverse_twiddles: torch.Tensor)Schedules and stage-expanded twiddles for indexed execution.
Index tensors are torch.int32 on the backend device. Preparation validates their per-stage coefficient partitions. The index structure stays fixed throughout execution; changing it requires preparing the schedule again. Twiddle tensors are integral [limb, stage, butterfly] Montgomery rows aligned with QP parameter columns.
Attributes
| Name | Type | Default/value |
|---|---|---|
forward_even_indices | torch.Tensor | |
forward_odd_indices | torch.Tensor | |
forward_twiddles | torch.Tensor | |
inverse_even_indices | torch.Tensor | |
inverse_odd_indices | torch.Tensor | |
inverse_twiddles | torch.Tensor |
CompactRadix2Tables
class View source
CompactRadix2Tables(forward_twiddles: torch.Tensor, inverse_twiddles: torch.Tensor)Compact execution tables aligned with QP parameter columns.
Montgomery tables have shape [limb,N]. Shoup32 tables have shape [limb,N,2] and contain standard-root/quotient-word pairs.
Attributes
| Name | Type | Default/value |
|---|---|---|
forward_twiddles | torch.Tensor | |
inverse_twiddles | torch.Tensor |
CompactPowerOfTwoRadixTables
class View source
CompactPowerOfTwoRadixTables(forward_outer_twiddles: torch.Tensor, inverse_outer_twiddles: torch.Tensor, forward_radix_root_powers: torch.Tensor, inverse_radix_root_powers: torch.Tensor)Packed outer twists and roots for strict fixed-radix digits.
Outer shapes are [limb, N - 1] and root shapes are [limb, radix] in QP row order, with Montgomery residues.
Attributes
| Name | Type | Default/value |
|---|---|---|
forward_outer_twiddles | torch.Tensor | |
inverse_outer_twiddles | torch.Tensor | |
forward_radix_root_powers | torch.Tensor | |
inverse_radix_root_powers | torch.Tensor |
NttTables
data View source
NttTables = IndexedRadix2Tables | CompactRadix2Tables | CompactPowerOfTwoRadixTablesMaterializeParameterRows
data View source
MaterializeParameterRows = Callable[[torch.Tensor], torch.Tensor]prepare_ntt_tables
function View source
def prepare_ntt_tables(policy: NttBackendPolicy, ckks_config: CkksConfig, *, materialize_parameter_rows: MaterializeParameterRows, device: torch.device, rns_params: torch.Tensor, dtype: torch.dtype) -> NttTables: ...Build execution-ready Tensor tables in the selected numerical layout.
Prime rows follow depth-zero QP order. Montgomery tables are converted during preparation using the supplied RNS parameters. Shoup32 pairs retain their standard roots and quotient words without Montgomery conversion.