Template Class Galoiskey< Scheme::BFV >
Defined in File evaluationkey.cuh
Inheritance Relationships
Derived Type
public heongpu::MultipartyGaloiskey< Scheme::BFV >(Template Class MultipartyGaloiskey< Scheme::BFV >)
Class Documentation
-
template<>
class Galoiskey<Scheme::BFV> Galoiskey represents a Galois key used for performing homomorphic operations such as rotations on encrypted data.
The Galoiskey class is initialized with encryption parameters and provides options to allow certain types of rotations. The Galois key can be used to rotate encrypted data by specific shifts or elements, which is useful in operations like ciphertext multiplication or encoding manipulations. The class also offers flexibility to store the key in either GPU or CPU memory.
Subclassed by heongpu::MultipartyGaloiskey< Scheme::BFV >
Public Functions
-
Galoiskey(HEContext<Scheme::BFV> context)
Constructs a new Galoiskey object with default settings that allow rotations in the range (-255, 255).
This range can be increased by modifying the definition in kernel/defines.h (MAX_SHIFT).
- Parameters:
context – Reference to the Parameters object that sets the encryption parameters.
-
Galoiskey(HEContext<Scheme::BFV> context, std::vector<int> &shift_vec)
Constructs a new Galoiskey object allowing specific rotations based on the given vector of shifts.
- Parameters:
context – Reference to the Parameters object that sets the encryption parameters.
shift_vec – Vector of integers representing the allowed shifts for rotations.
-
Galoiskey(HEContext<Scheme::BFV> context, std::vector<uint32_t> &galois_elts)
Constructs a new Galoiskey object allowing certain Galois elements given in a vector.
- Parameters:
context – Reference to the Parameters object that sets the encryption parameters.
galois_elts – Vector of Galois elements (represented as unsigned 32-bit integers) specifying the rotations allowed.
-
void store_in_device(cudaStream_t stream = cudaStreamDefault)
Stores the galois key in the device (GPU) memory.
-
void store_in_host(cudaStream_t stream = cudaStreamDefault)
Stores the galois 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(size_t i)
Returns a pointer to the specified part of the Galois key data.
- Parameters:
i – Index of the key elvel to access.
- Returns:
Data64* Pointer to the specified part of the Galois key data.
-
Data64 *c_data()
Returns a pointer to the Galois key data for column rotation(for BFV).
- Returns:
Data64* Pointer to the Galois key data for column rotation.
-
inline Galoiskey(const Galoiskey ©)
Copy constructor for creating a new Galoiskey object by copying an existing one.
This constructor copies data from an existing Galoiskey object, handling both GPU and CPU memory efficiently. GPU memory operations use
cudaMemcpyAsyncto ensure asynchronous data transfer.- Parameters:
copy – The source Galoiskey object to copy from.
-
inline Galoiskey(Galoiskey &&assign) noexcept
Move constructor for transferring ownership of an existing Galoiskey object.
Transfers all resources, including GPU and CPU memory, from the source object to the newly created object. The source object is left in a valid but undefined state.
- Parameters:
assign – The source Galoiskey object to move from.
-
inline Galoiskey &operator=(const Galoiskey ©)
Copy assignment operator for assigning one Galoiskey object to another.
Performs a deep copy of all resources, ensuring that the target object gets its own independent copy of the data, whether stored in GPU or CPU memory.
- Parameters:
copy – The source Galoiskey object to copy from.
- Returns:
Reference to the assigned object.
-
inline Galoiskey &operator=(Galoiskey &&assign) noexcept
Move assignment operator for transferring ownership of resources.
Transfers all resources, including GPU and CPU memory, from the source object to the target object. The source object is left in a valid but undefined state.
- Parameters:
assign – The source Galoiskey object to move from.
- Returns:
Reference to the assigned object.
-
Galoiskey() = default
Default constructor for Galoiskey.
Initializes an empty Galoiskey object. All members will have their default values.
-
void save(std::ostream &os) const
-
void load(std::istream &is)
-
Galoiskey(HEContext<Scheme::BFV> context)