fhelium.backend.rns.moddown
Auxiliary-basis removal in coefficient and NTT representations.
moddown_qp_to_q
function View source
def moddown_qp_to_q(source, tensors, attributes): ...Remove P from a coefficient-domain QP polynomial or component bundle.
moddown_ntt_qp_to_q
function View source
def moddown_ntt_qp_to_q(source: torch.Tensor, tensors: Mapping[str, torch.Tensor], attributes: Mapping[str, object], *, coefficient_c0: torch.Tensor | None=None) -> torch.Tensor: ...Return
source holds NTT/Montgomery residues over active QP. Inverting only the P rows determines the coefficient representative coefficient_c0 is supplied, it is added to component zero's coefficient correction before the forward NTT, adding NTT(c0) without another transform. The input c0 remains unchanged.
NativeModDownImplementation
class View source
NativeModDownImplementation(name: str = 'native-key-switch-moddown', supports_in_place: bool = False, operation_types: tuple[type[Operation], ...] = (rns.ModDownQpToQOp, rns.ModDownNttQpToQOp))Divide QP accumulators by P in coefficient or NTT representation.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-key-switch-moddown' |
supports_in_place | bool | False |
operation_types | tuple[type[Operation], ...] | (rns.ModDownQpToQOp, rns.ModDownNttQpToQOp) |
tensor_requirements | staticmethod(native_moddown_requirements) | |
prepare_operation | prepare_native_moddown |
resource_requirements
method
def resource_requirements(invocation: OperationInvocation) -> tuple[ResourceRequirement, ...]: ...execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...