Template Class Relinkey< Scheme::CKKS >

Inheritance Relationships

Derived Type

Class Documentation

template<>
class Relinkey<Scheme::CKKS>

Relinkey represents a relinearization key used for homomorphic encryption operations.

The Relinkey class is initialized with encryption parameters and optionally with key data. It provides methods for storing the relinearization key in GPU or CPU memory, which is essential for performing homomorphic operations that require relinearization, such as reducing the size of ciphertexts after multiplication.

Subclassed by heongpu::MultipartyRelinkey< Scheme::CKKS >

Public Functions

Relinkey(HEContext<Scheme::CKKS> context)

Constructs a new Relinkey object with specified parameters.

Parameters:

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

void store_in_device(cudaStream_t stream = cudaStreamDefault)

Stores the relinearization key in the device (GPU) memory.

void store_in_host(cudaStream_t stream = cudaStreamDefault)

Stores the relinearization key in the host (CPU) memory.

inline bool is_on_device() const

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

Data64 *data()

Returns a pointer to the underlying relinearization key data.

Returns:

Data64* Pointer to the relinearization key data.

Data64 *data(size_t i)

Returns a pointer to the specific part of the relinearization key data.

Parameters:

i – Index of the key level to access.

Returns:

Data64* Pointer to the specified part of the relinearization key data.

inline Relinkey(const Relinkey &copy)

Copy constructor for creating a new Relinkey object by copying an existing one.

This constructor copies data either from GPU or CPU memory, depending on the source. GPU memory operations are performed using cudaMemcpyAsync.

Parameters:

copy – The source Relinkey object to copy from.

inline Relinkey(Relinkey &&assign) noexcept

Move constructor for transferring ownership of an existing Relinkey object.

This constructor transfers resources from the source object to the newly constructed object. GPU and CPU memory resources are moved, leaving the source object in a valid but undefined state.

Parameters:

assign – The source Relinkey object to move from.

inline Relinkey &operator=(const Relinkey &copy)

Copy assignment operator for assigning one Relinkey object to another.

This operator performs a deep copy of all resources, including GPU and CPU memory, ensuring the target object has its own independent copy of the data.

Parameters:

copy – The source Relinkey object to copy from.

Returns:

Reference to the assigned object.

inline Relinkey &operator=(Relinkey &&assign) noexcept

Move assignment operator for transferring ownership of resources.

This operator moves all resources from the source object to the target object. GPU and CPU memory are efficiently transferred, leaving the source object in a valid but undefined state.

Parameters:

assign – The source Relinkey object to move from.

Returns:

Reference to the assigned object.

Relinkey() = default

Default constructor is deleted to ensure proper initialization of relinearization keys.

void save(std::ostream &os) const
void load(std::istream &is)
inline void set_context(HEContext<Scheme::CKKS> context)