Template Class HEEncoder< Scheme::CKKS >
Defined in File encoder.cuh
Class Documentation
-
template<>
class HEEncoder<Scheme::CKKS> HEEncoder is responsible for encoding messages into plaintexts suitable for homomorphic encryption.
The HEEncoder class is initialized with encryption parameters and provides methods to encode different types of messages (e.g., integers, floating-point numbers, complex numbers) into plaintexts for BFV and CKKS schemes. The class supports both synchronous and asynchronous encoding operations, making it suitable for different homomorphic encryption workflows.
Public Functions
-
HEEncoder(HEContext<Scheme::CKKS> &context)
Constructs a new HEEncoder object with specified parameters.
- Parameters:
context – Reference to the Parameters object that sets the encode parameters.
-
inline void encode(Plaintext<Scheme::CKKS> &plain, const std::vector<double> &message, double scale, const ExecutionOptions &options = ExecutionOptions())
Encodes a message of double values into a plaintext.
- Parameters:
plain – Plaintext object where the result of the encoding will be stored.
message – Vector of double values representing the message to be encoded.
scale – parameter defining encoding precision(for CKKS), default is 0.
-
inline void encode(Plaintext<Scheme::CKKS> &plain, const HostVector<double> &message, double scale, const ExecutionOptions &options = ExecutionOptions())
Encodes a message of double values into a plaintext.
- Parameters:
plain – Plaintext object where the result of the encoding will be stored.
message – HostVector of double values representing the message to be encoded.
scale – parameter defining encoding precision(for CKKS), default is 0.
-
inline void encode(Plaintext<Scheme::CKKS> &plain, const std::vector<Complex64> &message, double scale, const ExecutionOptions &options = ExecutionOptions())
Encodes a message of complex numbers into a plaintext.
- Parameters:
plain – Plaintext object where the result of the encoding will be stored.
message – Vector of Complex64 representing the message to be encoded.
scale – parameter defining encoding precision(for CKKS), default is 0.
-
inline void encode(Plaintext<Scheme::CKKS> &plain, const HostVector<Complex64> &message, double scale, const ExecutionOptions &options = ExecutionOptions())
Encodes a message of complex numbers into a plaintext.
- Parameters:
plain – Plaintext object where the result of the encoding will be stored.
message – HostVector of Complex64 representing the message to be encoded.
scale – parameter defining encoding precision(for CKKS), default is 0.
-
inline void encode(Plaintext<Scheme::CKKS> &plain, const double &message, double scale, const ExecutionOptions &options = ExecutionOptions())
Encodes a message of single double numbers into a plaintext.
- Parameters:
plain – Plaintext object where the result of the encoding will be stored.
message – Double representing the message to be encoded.
scale – parameter defining encoding precision(for CKKS), default is 0.
-
inline void encode(Plaintext<Scheme::CKKS> &plain, const std::int64_t &message, double scale, const ExecutionOptions &options = ExecutionOptions())
Encodes a message of single int64_t numbers into a plaintext.
- Parameters:
plain – Plaintext object where the result of the encoding will be stored.
message – int64_t representing the message to be encoded.
-
inline void decode(std::vector<double> &message, Plaintext<Scheme::CKKS> plain, const ExecutionOptions &options = ExecutionOptions())
Decodes a plaintext into a vector of double values.
- Parameters:
message – Vector where the decoded message will be stored.
plain – Plaintext object to be decoded.
-
inline void decode(HostVector<double> &message, Plaintext<Scheme::CKKS> plain, const ExecutionOptions &options = ExecutionOptions())
Decodes a plaintext into a HostVector of double values.
- Parameters:
message – HostVector where the decoded message will be stored.
plain – Plaintext object to be decoded.
-
inline void decode(std::vector<Complex64> &message, Plaintext<Scheme::CKKS> plain, const ExecutionOptions &options = ExecutionOptions())
Decodes a plaintext into a vector of complex numbers.
- Parameters:
message – Vector where the decoded message will be stored.
plain – Plaintext object to be decoded.
-
inline void decode(HostVector<Complex64> &message, Plaintext<Scheme::CKKS> plain, const ExecutionOptions &options = ExecutionOptions())
Decodes a plaintext into a HostVector of complex numbers.
- Parameters:
message – HostVector where the decoded message will be stored.
plain – Plaintext object to be decoded.
-
inline int slot_count() const noexcept
Returns the number of slots.
- Returns:
int Number of slots.
-
HEEncoder() = default
-
HEEncoder(HEContext<Scheme::CKKS> &context)