Template Class Plaintext< Scheme::CKKS >

Class Documentation

template<>
class Plaintext<Scheme::CKKS>

Plaintext represents the unencrypted data used in homomorphic encryption.

The Plaintext class is initialized with encryption parameters and optionally a CUDA stream. It provides methods to manage the underlying data, such as resizing, and transferring between host (CPU) and device (GPU). This class is used for preparing data for encoding, encryption, and other homomorphic operations.

Public Functions

explicit Plaintext(HEContext<Scheme::CKKS> &context, const ExecutionOptions &options = ExecutionOptions())

Constructs a new Plaintext object with specified parameters and an optional CUDA stream.

Parameters:
  • context – Reference to the Parameters object that sets the encryption parameters.

  • stream – The CUDA stream to be used for asynchronous operations. Defaults to cudaStreamDefault.

void store_in_device(cudaStream_t stream = cudaStreamDefault)

Stores the plaintext in the device (GPU) memory.

void store_in_host(cudaStream_t stream = cudaStreamDefault)

Stores the plaintext in the host (CPU) memory.

inline bool is_on_device() const noexcept

Checks whether the data is stored on the device (GPU) memory.

Data64 *data()

Returns a pointer to the underlying plaintext data.

Returns:

Data64* Pointer to the plaintext data.

inline int size() const noexcept

Returns the size of the plaintext.

Returns:

int Size of the plaintext.

inline int depth() const noexcept

Returns the current depth level of the plaintext.

Returns:

int Depth level of the plaintext.

inline double scale() const noexcept

Returns the scaling factor used for encoding in CKKS scheme.

Returns:

double Scaling factor.

inline bool in_ntt_domain() const noexcept

Indicates whether the plaintext is in the NTT (Number Theoretic Transform) domain.

Returns:

bool True if in NTT domain, false otherwise.

Plaintext() = default

Default constructor for Plaintext.

Initializes an empty Plaintext object. All members will have their default values.

inline Plaintext(const Plaintext &copy)
inline Plaintext(Plaintext &&assign) noexcept
inline Plaintext &operator=(const Plaintext &copy)
inline Plaintext &operator=(Plaintext &&assign) noexcept
void save(std::ostream &os) const
void load(std::istream &is)