fhelium.backend.ntt.context
Provide NTT tables and transforms over a device-local RNS context.
NttContext
class View source
NttContext(rns_context: RnsContext, ntt_backend: str | None=None)Own one NTT policy and its tables, and use shared prepared transforms.
The context composes an RnsContext whose parameter tensor is passed unchanged to native NTT executors. Transform methods preserve prime rows and operand storage unless the method is the functional forward_to_montgomery variant.
tensor_operands
method
def tensor_operands(prime_ids: tuple[int, ...], *, inverse: bool) -> tuple[torch.Tensor, ...]: ...Return native table views for the selected rows and transform direction.
Parameter generation belongs to this context. The returned Tensors can be supplied directly or placed in a Program's external material table.
forward_montgomery_
method
def forward_montgomery_(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> None: ...Apply the negacyclic forward NTT to Montgomery residues in place.
forward_to_montgomery_
method
def forward_to_montgomery_(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> None: ...Apply forward NTT and standard-to-Montgomery conversion in place.
forward_to_montgomery
method
def forward_to_montgomery(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> torch.Tensor: ...Return the non-aliasing forward NTT/Montgomery transition.
inverse_montgomery_
method
def inverse_montgomery_(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> None: ...Apply normalized inverse NTT and keep Montgomery form.
inverse_to_standard_lazy_
method
def inverse_to_standard_lazy_(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> None: ...Inverse NTT to coefficient/standard lazy residues in place.
inverse_to_standard_
method
def inverse_to_standard_(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> None: ...Inverse NTT to coefficient/standard reduced residues in place.
inverse_to_centered_
method
def inverse_to_centered_(a: torch.Tensor, *, include_p: bool=False, parameter_row_start: int | None=None) -> None: ...Inverse NTT to centered coefficient/standard residues in place.