fhelium.experimental.bootstrap.structural
Bootstrap entry coordinates and composable modulus-raising components.
ModulusRaising
class View source
ModulusRaising()Bases: Protocol
Map source Q coordinates to coefficient/standard target Q ciphertexts.
CenteredModRaise
class View source
CenteredModRaise()Extend each component's centered CRT representative into target Q.
The lifted decryption phase contains the source modulus times an integer polynomial. The following Fourier and periodic reduction handle that term.
ScaledModRaise
class View source
ScaledModRaise(inner: ModulusRaising, multiplier: int)Raise the modulus and multiply its internal scale by an integer.
For the wrapped result (c, Delta), integer payload multiplication followed by the corresponding scale transition produces (kc, kDelta), preserving its represented message. The following transform schedule consumes its existing Q groups; this component adds no modulus rows and performs no rescale. Existing decoded error is unchanged; the larger scale reduces the normalized contribution of subsequent key-switch errors. The multiplier is a mathematical scale choice shared by Eager and captured execution.
Attributes
| Name | Type | Default/value |
|---|---|---|
inner | ModulusRaising | |
multiplier | int |
EncapsulatedModRaise
class View source
EncapsulatedModRaise(low_key: KeySwitchKey, return_key: KeySwitchKey, low_p_moduli: tuple[int, ...], return_prime: int, return_p_moduli: tuple[int, ...], moddown_rounding: Literal['nearest', 'floor'] = 'nearest')Bind low and return hints for an intermediate secret relation.
low_key encrypts P_lowE_js under t. return_key has one digit encrypting guardP_returnt under s. Both are ordinary KeySwitchKey values; the component retains their live tensors, not either secret. Execution switches to t, centered-raises, then returns to s before Fourier transforms. Secret distributions, modulus choices and reducer range are caller choices.
Attributes
| Name | Type | Default/value |
|---|---|---|
low_key | KeySwitchKey | |
return_key | KeySwitchKey | |
low_p_moduli | tuple[int, ...] | |
return_prime | int | |
return_p_moduli | tuple[int, ...] | |
moddown_rounding | Literal['nearest', 'floor'] | 'nearest' |
reference_centered_basis_extend
function View source
def reference_centered_basis_extend(residues: torch.Tensor, *, source_moduli: Sequence[int], target_moduli: Sequence[int], centered: bool=True) -> torch.Tensor: ...Reconstruct source integers and reduce them into a target RNS basis.
This reference applies CRT with Python integers to each coefficient for comparison with the native mixed-radix path. When centered is true, representatives greater than half the source modulus product are interpreted as negative before reduction into each target modulus.
Parameters
residues: Tensor shaped[..., source_row, coefficient].source_moduli: Modulus corresponding to each source row.target_moduli: Moduli of the desired output rows.centered: Choose signed half-interval representatives instead of least nonnegative representatives.
Returns
Tensor on the original device with shape [..., target_row, coefficient] and the same integer dtype.