Template Class Ciphertext< Scheme::CKKS >

Class Documentation

template<>
class Ciphertext<Scheme::CKKS>

Public Functions

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

Constructs a new Ciphertext object with specified parameters and 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 ciphertext in the device (GPU) memory.

void store_in_host(cudaStream_t stream = cudaStreamDefault)

Stores the ciphertext 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 data of the ciphertext.

Returns:

Data64* Pointer to the data.

void get_data(std::vector<Data64> &cipher, cudaStream_t stream = cudaStreamDefault)

Copies the data from the device to the host.

Parameters:
  • cipher – Reference to a vector where the device data will be copied to.

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

void get_data(HostVector<Data64> &cipher, cudaStream_t stream = cudaStreamDefault)

Copies the data from the device to the host.

Parameters:
  • cipher – Reference to a HostVector where the device data will be copied to.

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

inline void switch_stream(cudaStream_t stream)

Switches the Ciphertext CUDA stream.

Parameters:

stream – The new CUDA stream to be used.

inline cudaStream_t stream() const noexcept

Retrieves the CUDA stream associated with the ciphertext.

This function returns the CUDA stream that was used to create or last modify the ciphertext.

Returns:

The CUDA stream associated with the ciphertext.

inline int ring_size() const noexcept

Returns the size of the polynomial ring used in ciphertext.

Returns:

int Size of the polynomial ring.

inline int coeff_modulus_count() const noexcept

Returns the number of coefficient modulus primes used in the ciphertext.

Returns:

int Number of coefficient modulus primes.

inline int size() const noexcept

Returns the size of the ciphertext.

Returns:

int Size of the ciphertext.

inline int depth() const noexcept

Returns the depth level of the ciphertext.

Returns:

int Depth level of the ciphertext.

inline int level() const noexcept

Returns the level of the ciphertext.

Returns:

int Level of the ciphertext.

inline bool in_ntt_domain() const noexcept

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

Returns:

bool True if in NTT domain, false otherwise.

inline double scale() const noexcept

Returns the scaling factor used for encoding in CKKS scheme.

Returns:

double Scaling factor.

inline bool rescale_required() const noexcept

Indicates whether rescaling is required for the ciphertext.

Returns:

bool True if rescaling is required, false otherwise.

inline bool relinearization_required() const noexcept

Indicates whether relinearization is required for the ciphertext.

Returns:

bool True if relinearization is required, false otherwise.

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