fhelium.backend.ckks.arithmetic
Whole ciphertext convolution and compressed-plaintext arithmetic.
NativeCiphertextMultiplyImplementation
class View source
python
NativeCiphertextMultiplyImplementation(supports_in_place: bool = False, name: str = 'native-ct2-convolution', operation_types: tuple[type[Operation], ...] = (ckks.MultiplyOp,))1
Execute whole two-component CKKS convolution in one native call.
Attributes
| Name | Type | Default/value |
|---|---|---|
supports_in_place | bool | False |
name | str | 'native-ct2-convolution' |
operation_types | tuple[type[Operation], ...] | (ckks.MultiplyOp,) |
tensor_requirements
method
python
def tensor_requirements(operation, config): ...1
supports_operation
method
python
def supports_operation(operation: Operation) -> bool: ...1
Require the numerical operands consumed by this whole implementation.
resource_requirements
method
python
def resource_requirements(invocation: OperationInvocation) -> tuple[ResourceRequirement, ...]: ...1
execute
method
python
def execute(invocation: OperationInvocation, inputs: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...1
NativeCompressedPlaintextImplementation
class View source
python
NativeCompressedPlaintextImplementation()1
Evaluate compact plaintext layouts without expanding plaintext storage.
Coefficient addition consumes pR. NTT addition first represents the compact plaintext as pR², then reuses the coefficient primitive's REDC to compute cR+pR. Sparse multiplication fills implicit positions using a one-value cyclic row and replaces the strided explicit positions with their products.
Attributes
| Name | Type | Default/value |
|---|---|---|
supports_in_place | True | |
name | 'native-compressed-plaintext' | |
operation_types | (ckks.AddCompressedPlaintextOp, ckks.MultiplyCompressedPlaintextOp) |
resource_requirements
method
python
def resource_requirements(invocation): ...1
execute
method
python
def execute(invocation, inputs, resources, *, in_place): ...1