fhelium.ir.dialects.ckks
Cheon-Kim-Kim-Song (CKKS) evaluator operations and value state.
A two-component ciphertext (CT2) has phase
AddOp
class View source
AddOp()Bases: _BinaryCiphertextOp
Add two state-compatible ciphertexts component by component.
For each component
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.add' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
SumBatchOp
class View source
SumBatchOp(value: SSAValue | Operation, result_type: Attribute, *, axis: int | IntegerAttr, parameters: Sequence[SSAValue | Operation]=())Bases: IRDLOperation
Reduce one ciphertext batch axis by modular addition.
For components
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.sum_batch' | |
value | operand_def(CiphertextType) | |
parameters | var_operand_def() | |
result | result_def(CiphertextType) | |
axis | attr_def(IntegerAttr) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
AddScalarOp
class View source
AddScalarOp()Bases: _RealScalarCiphertextOp
Add a stochastically quantized real constant to component zero.
The input uses coefficient-domain standard residues. For scalar scalar_scale
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.add_scalar' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
AddPlaintextOp
class View source
AddPlaintextOp()Bases: _CiphertextPlaintextOp
Add a prepared plaintext polynomial to ciphertext component zero.
For ciphertext
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.add_plaintext' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
AddCompressedPlaintextOp
class View source
AddCompressedPlaintextOp()Bases: _CiphertextCompressedPlaintextOp
Add a compact plaintext to component zero without expanding its rows.
Coefficient/standard ciphertext and coefficient/Montgomery plaintext give c'_0=c_0+REDC(pR). NTT/Montgomery operands give c'_0=c_0+pR. Other components, depth, scale, prime rows and representation are preserved. Sparse layouts supply a separate [*batch, limb, 1] implicit-value Tensor.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.add_compressed_plaintext' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe direct ciphertext reads and compact plaintext expansion.
CiphertextType
class View source
CiphertextType()Bases: OpenStateType
CKKS ciphertext with partial depth, scale, basis, and domain state.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.ciphertext' | |
ROLE | ClassVar[ValueRole] | 'encrypted' |
CompressedPlaintextType
class View source
CompressedPlaintextType()Bases: OpenStateType
Represent operation-ready compressed RNS plaintext storage.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.compressed_plaintext' | |
ROLE | ClassVar[ValueRole] | 'plaintext' |
ConjugateOp
class View source
ConjugateOp()Bases: _OutputDomainCiphertextOp
Apply complex conjugation to every encoded CKKS slot.
The input is a coefficient-domain standard-Q CT2 ciphertext. The ring automorphism output_domain selects coefficient/standard or NTT/Montgomery output. CT2 shape, depth, actual scale, and active Q rows are preserved.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.conjugate' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
DecodeOp
class View source
DecodeOp()Bases: IRDLOperation
Decode a scaled coefficient polynomial into ordered CKKS slots.
For coefficient data is_real selects the real part after the complex embedding. The input may be freshly encoded integers or bounded approximate coefficients reconstructed by decryption.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.decode' | |
plaintext | operand_def(PlaintextType) | |
parameters | var_operand_def() | |
result | result_def(MessageType) | |
is_real | attr_def(IntegerAttr) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
DecryptOp
class View source
DecryptOp()Bases: IRDLOperation
Evaluate a ciphertext phase and reconstruct coefficient data.
For CT2 input_domain records whether the ciphertext payload arrives in coefficient/standard or NTT/Montgomery form, and the second operand supplies the secret-key Tensor.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.decrypt' | |
ciphertext | operand_def(CiphertextType) | |
key | operand_def() | |
parameters | var_operand_def() | |
result | result_def(PlaintextType) | |
input_domain | attr_def(StringAttr) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
PrepareCompressedPlaintextOp
class View source
PrepareCompressedPlaintextOp()Bases: IRDLOperation
Prepare compressed NTT rows from a periodic slot message.
For U=2r (at least four for generator 3), R=N/U and a period-r message, the encoded polynomial has the form p(X)=a(X^R). The operation performs the U-point inverse embedding, stochastic rounding at the corresponding full-ring random-stream positions, RNS reduction and a U-point NTT with roots psi_N^R for NTT output. Coefficient output omits the transform and returns strided-sparse compact data plus zero implicit rows; NTT output uses contiguous repetition. Both use Montgomery residues and preserve the supplied depth, prime rows and actual scale.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare_compressed_plaintext' | |
message | operand_def(MessageType) | |
parameters | var_operand_def() | |
results_ | var_result_def() | |
traits | traits_def() |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
EncodeOp
class View source
EncodeOp()Bases: IRDLOperation
Encode ordered complex slots as a scaled integer polynomial.
For ring depth records the later modulus-chain placement but does not reduce the integer coefficients. The registered native-ckks-encode implementation performs the embedding and stochastic rounding.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.encode' | |
message | operand_def(MessageType) | |
parameters | var_operand_def() | |
result | result_def(PlaintextType) | |
depth | attr_def(IntegerAttr) | |
scale | attr_def(FloatAttr) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
EncryptOp
class View source
EncryptOp()Bases: IRDLOperation
Encrypt an integer plaintext polynomial as a CT2 ciphertext.
Let the public key be output_domain selects coefficient/standard or NTT/Montgomery Q or QP residues. The second operand supplies the public-key Tensor.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.encrypt' | |
plaintext | operand_def(PlaintextType) | |
key | operand_def() | |
parameters | var_operand_def() | |
result | result_def(CiphertextType) | |
output_domain | attr_def(StringAttr, default_value=StringAttr('coefficient')) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe plaintext addition and multiplication by the public key.
EvaluationKeyType
class View source
EvaluationKeyType()Bases: OpenStateType
Evaluation-key Tensor with partial digit, row, and polynomial state.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.evaluation_key' |
FHEliumCkks
data View source
FHEliumCkks = Dialect('fhelium_ckks', [PrepareCompressedPlaintextOp, EncodeOp, DecodeOp, IntegerCoefficientsToRnsOp, EncryptOp, DecryptOp, NegateOp, RotateOp, RotateManyOp, GroupedRotationWeightedSumOp, ToNttOp, FromNttOp, ToMontgomeryResiduesOp, ToStandardResiduesOp, AddOp, SumBatchOp, SubtractOp, MultiplyOp, AddScalarOp, MultiplyScalarOp, MultiplyIntegerScalarOp, AddPlaintextOp, MultiplyPlaintextOp, AddCompressedPlaintextOp, MultiplyCompressedPlaintextOp, RelinearizeOp, SwitchKeyOp, ConjugateOp, RescaleOp, ModSwitchOp, ReinterpretScaleOp, PrepareAddMessageOp, PrepareAddPlaintextOp, PrepareAddStaticOp, PrepareMultiplyMessageOp, PrepareMultiplyPlaintextOp, PrepareMultiplyStaticOp], [CiphertextType, PlaintextType, CompressedPlaintextType, EvaluationKeyType])FromNttOp
class View source
FromNttOp()Bases: _RepresentationOp
Transform CKKS NTT/Montgomery polynomials to coefficient form.
An inverse negacyclic transform is applied independently to every component and prime row. Ciphertexts end in standard residues; plaintext lowering may retain Montgomery residues. The represented ring element, component count, prime rows, depth, basis, and actual scale are unchanged.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.from_ntt' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
GroupedRotationWeightedSumOp
class View source
GroupedRotationWeightedSumOp(value: SSAValue | Operation, keys: tuple[SSAValue | Operation, ...], plaintexts: tuple[SSAValue | Operation, ...], result_type: CiphertextType, *, baby_steps: tuple[int, ...], group_count: int, parameters: Sequence[SSAValue | Operation]=())Bases: IRDLOperation
Apply plaintext rows to one caller-supplied direct rotation group.
For baby steps
baby_steps lists group_count and term_count describe the plaintext matrix. Every rotation completes its own hybrid ModDown before plaintext multiplication, preserving ordinary key-switch rounding. The output adds the group as the first batch axis and is NTT/Montgomery Q at the input depth with scale
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.grouped_rotation_weighted_sum' | |
value | operand_def(CiphertextType) | |
keys | var_operand_def(EvaluationKeyType) | |
plaintexts | var_operand_def(PlaintextType) | |
parameters | var_operand_def() | |
result | result_def(CiphertextType) | |
baby_steps | attr_def(ArrayAttr[IntegerAttr]) | |
term_count | attr_def(IntegerAttr) | |
group_count | attr_def(IntegerAttr) | |
traits | traits_def(Pure()) | |
irdl_options | (AttrSizedOperandSegments(as_property=True),) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe the rotated input, evaluation keys and plaintext weights.
verify_
method
def verify_() -> None: ...ModSwitchOp
class View source
ModSwitchOp()Bases: _UnaryCiphertextOp
Restrict a ciphertext to the Q rows at target_depth.
Rows removed before the target depth are discarded without dividing or rounding any coefficient. Surviving residue values and the ciphertext actual scale are unchanged. The operation therefore changes the modulus and depth, not the scale; component count, polynomial domain, and residue representation are preserved.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.mod_switch' | |
target_depth | attr_def(IntegerAttr) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyOp
class View source
MultiplyOp()Bases: _BinaryCiphertextOp
Multiply two CT2 ciphertexts by polynomial convolution.
For
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.multiply' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyIntegerScalarOp
class View source
MultiplyIntegerScalarOp(ciphertext: SSAValue | Operation, result_type: Attribute | None=None, *, parameters: Sequence[SSAValue | Operation]=(), scalar: IntegerAttr, attributes: Mapping[str, Attribute] | None=None)Bases: IRDLOperation
Multiply every ciphertext component by an integer scalar.
For integer
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.multiply_integer_scalar' | |
ciphertext | operand_def(CiphertextType) | |
parameters | var_operand_def() | |
result | result_def(CiphertextType) | |
scalar | attr_def(IntegerAttr) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyScalarOp
class View source
MultiplyScalarOp()Bases: _RealScalarCiphertextOp
Multiply all ciphertext components by a quantized real constant.
For scalar
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.multiply_scalar' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyPlaintextOp
class View source
MultiplyPlaintextOp()Bases: _CiphertextPlaintextOp
Multiply each ciphertext component by a prepared plaintext polynomial.
For ciphertext components
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.multiply_plaintext' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyCompressedPlaintextOp
class View source
MultiplyCompressedPlaintextOp()Bases: _CiphertextCompressedPlaintextOp
Multiply ciphertext components by compressed NTT plaintext data.
The compressed layout expands logically to a prepared NTT/Montgomery plaintext
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.multiply_compressed_plaintext' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe direct ciphertext reads and compact plaintext expansion.
NegateOp
class View source
NegateOp()Bases: _UnaryCiphertextOp
Negate every component of a CKKS ciphertext.
For
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.negate' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
PlaintextType
class View source
PlaintextType()Bases: OpenStateType
CKKS plaintext with partial encoding and RNS representation state.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.plaintext' | |
ROLE | ClassVar[ValueRole] | 'plaintext' |
OPERATION_SPECS
constant View source
OPERATION_SPECS: tuple[OperationSpec, ...] = (registered_operation_spec(PrepareCompressedPlaintextOp, 'ckks', effect='rng-write', validator=flat_with_attributes('depth', 'scale', 'ring_dimension', 'min_modulus', 'polynomial_domain')), registered_operation_spec(EncodeOp, 'ckks', effect='rng-write', validator=flat_with_attributes('depth', 'scale')), registered_operation_spec(DecodeOp, 'ckks', validator=flat_with_attributes('is_real')), registered_operation_spec(IntegerCoefficientsToRnsOp, 'ckks', validator=flat_with_attributes('modulus_basis', 'depth')), registered_operation_spec(EncryptOp, 'ckks', effect='rng-write', validator=lambda operation: (*flat_with_attributes('output_domain')(operation), *_rotation_output_state_diagnostics(cast(EncryptOp, operation)))), registered_operation_spec(DecryptOp, 'ckks', validator=_decrypt_specification), registered_operation_spec(SumBatchOp, 'ckks', validator=flat_with_attributes('axis')), *(registered_operation_spec(op, 'ckks', validator=flat_operation) for op in (NegateOp, ToNttOp, FromNttOp, ToMontgomeryResiduesOp, ToStandardResiduesOp, AddOp, SubtractOp, AddPlaintextOp, MultiplyPlaintextOp)), registered_operation_spec(RotateOp, 'ckks', validator=_with_ciphertext_components(_rotate_specification, operands=((0, 2),), results=((0, 2),))), registered_operation_spec(RotateManyOp, 'ckks', validator=_with_ciphertext_components(_hoisted_rotate_many_specification, operands=((0, 2),), every_result=2)), registered_operation_spec(GroupedRotationWeightedSumOp, 'ckks', validator=_with_ciphertext_components(flat_with_attributes('baby_steps', 'term_count', 'group_count'), operands=((0, 2),), results=((0, 2),))), registered_operation_spec(MultiplyOp, 'ckks', validator=_with_ciphertext_components(flat_operation, operands=((0, 2), (1, 2)), results=((0, 3),))), registered_operation_spec(AddCompressedPlaintextOp, 'ckks', validator=flat_with_attributes('inplace', 'compression_layout', 'polynomial_domain')), registered_operation_spec(MultiplyCompressedPlaintextOp, 'ckks', validator=flat_with_attributes('inplace', 'compression_layout')), registered_operation_spec(RelinearizeOp, 'ckks', validator=_with_ciphertext_components(lambda operation: (*flat_with_attributes('output_domain')(operation), *_rotation_output_state_diagnostics(cast(RelinearizeOp, operation))), operands=((0, 3),), results=((0, 2),))), registered_operation_spec(SwitchKeyOp, 'ckks', validator=_with_ciphertext_components(lambda operation: (*flat_with_attributes('output_domain')(operation), *_rotation_output_state_diagnostics(cast(SwitchKeyOp, operation))), operands=((0, 2),), results=((0, 2),))), registered_operation_spec(ConjugateOp, 'ckks', validator=_with_ciphertext_components(lambda operation: (*flat_with_attributes('output_domain')(operation), *_rotation_output_state_diagnostics(cast(ConjugateOp, operation))), operands=((0, 2),), results=((0, 2),))), registered_operation_spec(RescaleOp, 'ckks', validator=_rescale_specification), registered_operation_spec(ModSwitchOp, 'ckks', validator=flat_with_attributes('target_depth')), registered_operation_spec(ReinterpretScaleOp, 'ckks', validator=flat_with_attributes('scale')), *(registered_operation_spec(operation_type, 'ckks', effect='rng-write', validator=_prepare_specification(operation, role)) for operation, role, operation_type in (('add', 'message', PrepareAddMessageOp), ('add', 'plaintext', PrepareAddPlaintextOp), ('add', 'static', PrepareAddStaticOp), ('multiply', 'message', PrepareMultiplyMessageOp), ('multiply', 'plaintext', PrepareMultiplyPlaintextOp), ('multiply', 'static', PrepareMultiplyStaticOp))), *(registered_operation_spec(operation_type, 'ckks', effect='rng-write', validator=flat_with_attributes('scalar', 'scalar_scale')) for operation_type in (AddScalarOp, MultiplyScalarOp)), registered_operation_spec(MultiplyIntegerScalarOp, 'ckks', validator=flat_with_attributes('scalar')))PrepareAddMessageOp
class View source
PrepareAddMessageOp()Bases: _PrepareOp
Encode a public message for ciphertext addition.
The message is encoded at the ciphertext depth and actual scale, reduced into the ciphertext's Q or QP rows, and converted to coefficient-domain Montgomery residues. The prepared polynomial can then be added to component zero by AddPlaintextOp without changing ciphertext depth or scale.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare.add.message' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
PrepareAddPlaintextOp
class View source
PrepareAddPlaintextOp()Bases: _PrepareOp
Convert a caller-owned plaintext to addition-ready RNS state.
The plaintext already supplies its actual scale and depth; both must match the ciphertext. Encoding or residue conversion as needed produces coefficient-domain Montgomery rows in the ciphertext's Q or QP basis. No message arithmetic is performed before AddPlaintextOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare.add.plaintext' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
PrepareAddStaticOp
class View source
PrepareAddStaticOp()Bases: _PrepareOp
Encode a statically known public value for ciphertext addition.
The value is encoded at the ciphertext actual scale and depth, reduced to the same Q or QP rows, and converted to coefficient-domain Montgomery form. The result has the state required by AddPlaintextOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare.add.static' |
PrepareMultiplyMessageOp
class View source
PrepareMultiplyMessageOp()Bases: _PrepareOp
Encode a public message for ciphertext multiplication.
The message is encoded at the selected default actual scale, placed at the ciphertext depth, reduced into matching Q or QP rows, and transformed to NTT/Montgomery form. MultiplyPlaintextOp then produces scale
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare.multiply.message' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
PrepareMultiplyPlaintextOp
class View source
PrepareMultiplyPlaintextOp()Bases: _PrepareOp
Convert a caller-owned plaintext to multiplication-ready state.
The plaintext retains its own actual scale and must share the ciphertext depth and Q or QP rows. Encoding, residue conversion, and a forward NTT as needed produce NTT/Montgomery data for MultiplyPlaintextOp. Preparation itself does not multiply or rescale.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare.multiply.plaintext' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
PrepareMultiplyStaticOp
class View source
PrepareMultiplyStaticOp()Bases: _PrepareOp
Encode a statically known public value for ciphertext multiplication.
The value is encoded at the selected default actual scale and ciphertext depth, reduced into matching Q or QP rows, and transformed to NTT/Montgomery form. Its scale later multiplies the ciphertext scale in MultiplyPlaintextOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.prepare.multiply.static' |
IntegerCoefficientsToRnsOp
class View source
IntegerCoefficientsToRnsOp()Bases: IRDLOperation
Reduce integer polynomial coefficients into active RNS rows.
RNS means residue number system. At depth QP, to
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.integer_coefficients_to_rns' | |
plaintext | operand_def(PlaintextType) | |
parameters | var_operand_def() | |
result | result_def(PlaintextType) | |
modulus_basis | attr_def(StringAttr) | |
depth | attr_def(IntegerAttr) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
RelinearizeOp
class View source
RelinearizeOp()Bases: _OutputDomainCiphertextOp
Convert a three-component product ciphertext to two components.
The input is an NTT/Montgomery CT3 product. For phase output_domain selects coefficient/standard or NTT/Montgomery output.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.relinearize' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
ReinterpretScaleOp
class View source
ReinterpretScaleOp()Bases: _UnaryCiphertextOp
Replace ciphertext scale metadata while preserving all residues.
The recorded actual scale becomes the supplied
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.reinterpret_scale' | |
scale | attr_def(FloatAttr) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
RescaleOp
class View source
RescaleOp(value: SSAValue | Operation, result_type: Attribute | None=None, *, parameters: Sequence[SSAValue | Operation]=(), rounding: str | StringAttr='nearest', polynomial_domain: Literal['coefficient', 'ntt']='coefficient', attributes: Mapping[str, Attribute] | None=None)Bases: IRDLOperation
Divide a ciphertext by its leading Q depth-group product.
For group rounding selects the quotient rule.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.rescale' | |
value | operand_def(CiphertextType) | |
parameters | var_operand_def() | |
result | result_def(CiphertextType) | |
rounding | opt_attr_def(StringAttr) | |
input_domain | attr_def(StringAttr, default_value=StringAttr('coefficient')) | |
output_domain | attr_def(StringAttr, default_value=StringAttr('coefficient')) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe the rounded quotient in its represented polynomial domain.
verify_
method
def verify_() -> None: ...Accept only represented CKKS quotient-rounding rules when present.
RotateOp
class View source
RotateOp(value: SSAValue | Operation, key: SSAValue | Operation, result_type: Attribute | None=None, *, parameters: Sequence[SSAValue | Operation]=(), attributes: Mapping[str, Attribute] | None=None)Bases: IRDLOperation
Rotate CKKS slots through a Galois automorphism and key switch.
The input is a CT2 ciphertext in coefficient/standard or NTT/Montgomery Q state. A rotation key records a signed slot displacement output_domain selects coefficient/standard or NTT/Montgomery output; the NTT choice equals a coefficient rotation followed by ToNttOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.rotate' | |
value | operand_def(CiphertextType) | |
key | operand_def(EvaluationKeyType) | |
parameters | var_operand_def() | |
result | result_def(CiphertextType) | |
output_domain | attr_def(StringAttr, default_value=StringAttr('coefficient')) | |
input_domain | attr_def(StringAttr, default_value=StringAttr('coefficient')) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
RotateManyOp
class View source
RotateManyOp(value: SSAValue | Operation, keys: tuple[SSAValue | Operation, ...], result_types: tuple[CiphertextType, ...], *, output_domain: Literal['coefficient', 'ntt']='coefficient', parameters: Sequence[SSAValue | Operation]=(), attributes: Mapping[str, Attribute] | None=None)Bases: IRDLOperation
Produce several slot rotations from one shared key-switch preparation.
The input is a coefficient-domain standard-Q CT2 ciphertext. Each key operand defines one Galois automorphism and signed slot displacement. For every key the mathematical result equals an independent RotateOp of the same input. Hoisting shares hybrid digit decomposition and Q-to-QP basis-extension work across outputs but does not change their order or values. Every result preserves the input depth, actual scale, and active Q rows. output_domain selects coefficient/standard (the default) or NTT/Montgomery output. The latter equals applying ToNttOp to each coefficient result and permits ModDown to retain Q evaluations.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.hoisted_rotate_many' | |
value | operand_def(CiphertextType) | |
keys | var_operand_def(EvaluationKeyType) | |
parameters | var_operand_def() | |
outputs | var_result_def(CiphertextType) | |
irdl_options | (AttrSizedOperandSegments(as_property=True),) | |
output_domain | attr_def(StringAttr, default_value=StringAttr('coefficient')) | |
traits | traits_def(Pure()) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe each rotation's reads from the ciphertext and its key.
verify_
method
def verify_() -> None: ...SubtractOp
class View source
SubtractOp()Bases: _BinaryCiphertextOp
Subtract ciphertexts component by component.
For each component
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.subtract' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
SwitchKeyOp
class View source
SwitchKeyOp()Bases: _OutputDomainCiphertextOp
Change the secret-key relation of a CT2 ciphertext.
The input is a coefficient-domain standard-Q CT2 ciphertext. For phase output_domain selects coefficient/standard or NTT/Montgomery output. Depth, actual scale, active Q rows, and component count are preserved.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.switch_key' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
ToNttOp
class View source
ToNttOp()Bases: _RepresentationOp
Transform CKKS residue polynomials to NTT/Montgomery form.
For each component and active prime
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.to_ntt' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
ToMontgomeryResiduesOp
class View source
ToMontgomeryResiduesOp()Bases: _RepresentationOp
Multiply coefficient-domain plaintext residues by the Montgomery radix.
For each active prime
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.to_montgomery_residues' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
ToStandardResiduesOp
class View source
ToStandardResiduesOp()Bases: _RepresentationOp
Remove the Montgomery factor from coefficient-domain plaintext rows.
For each active prime
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_ckks.to_standard_residues' |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.