fhelium.experimental.bootstrap.structural
Centered modulus raising and its integer-RNS reference helpers.
reference_centered_basis_extend
function View source
python
def reference_centered_basis_extend(residues: torch.Tensor, *, source_moduli: Sequence[int], target_moduli: Sequence[int], centered: bool=True) -> torch.Tensor: ...1
Reconstruct source integers and reduce them into a target RNS basis.
This deliberately slow implementation is a test oracle for the native mixed-radix path. It applies ordinary CRT with Python integers to every coefficient. 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.
ModRaisedCiphertext
class View source
python
ModRaisedCiphertext(ciphertext: Ciphertext, source_depth: int, source_prime_ids: tuple[int, ...], source_modulus_bits: int, scale: float)1
A ciphertext plus the depleted Q basis extended by ModRaise.
Attributes
| Name | Type | Default/value |
|---|---|---|
ciphertext | Ciphertext | |
source_depth | int | |
source_prime_ids | tuple[int, ...] | |
source_modulus_bits | int | |
scale | float |
from_engine
method
python
def from_engine(engine: Engine, ciphertext: Ciphertext, *, source_depth: int, scale: float) -> ModRaisedCiphertext: ...1
Attach the source basis needed by the first raised transform.