fhelium.engine.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. Twiddle tensors are integral [limb, stage, butterfly] rows aligned with canonical QP parameter columns; they begin in standard form and are converted in place to Montgomery form without changing shape, dtype, device, or storage.
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 |
convert_twiddles_to_montgomery_
method
def convert_twiddles_to_montgomery_(rns_params: torch.Tensor) -> None: ...CompactRadix2Tables
class View source
CompactRadix2Tables(forward_twiddles: torch.Tensor, inverse_twiddles: torch.Tensor)Canonical [limb, N] twiddle rows for production kernels.
Rows align exactly with canonical QP parameter columns. Conversion mutates each integral table from standard to Montgomery residues in place.
Attributes
| Name | Type | Default/value |
|---|---|---|
forward_twiddles | torch.Tensor | |
inverse_twiddles | torch.Tensor |
convert_twiddles_to_montgomery_
method
def convert_twiddles_to_montgomery_(rns_params: torch.Tensor) -> None: ...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 canonical QP row order. Conversion mutates each integral table from standard to Montgomery residues in place.
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 |
convert_twiddles_to_montgomery_
method
def convert_twiddles_to_montgomery_(rns_params: torch.Tensor) -> None: ...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) -> NttTables: ...Build a plan and return separately allocated backend table tensors.
Prime rows follow the config's canonical level-zero QP order exactly. Returned tensors use ckks_config.torch_dtype on device and remain in standard representation until RnsRuntime converts them in place.