HEaaN
Crypto Lab's great homomorphic encryption library
Public Member Functions | Private Attributes | List of all members
HEaaN::Bootstrapper Class Reference

A class consisting of bootstrap and its related functions. More...

#include <Bootstrapper.hpp>

Public Member Functions

 Bootstrapper (const HomEvaluator &eval, const u64 log_slots)
 Constructs a class for boostrap. Pre-computation of bootstrapping constants is included. More...
 
 Bootstrapper (const HomEvaluator &eval)
 
 Bootstrapper (const HomEvaluator &eval, const Context &context_sparse, const u64 log_slots)
 Constructs a class for boostrap which can perform sparse secret encapsulation, using the same Parameter as eval. Includes pre-computation of bootstrapping constants. More...
 
 Bootstrapper (const HomEvaluator &eval, const Context &context_sparse)
 
bool isBootstrapReady (const u64 log_slots) const
 Check whether bootstrap is available. More...
 
void makeBootConstants (const u64 log_slots)
 make the pre-computed data for bootstrapping More...
 
void loadBootConstants (const u64 log_slots, const Device &device) const
 load the pre-computed data for bootstrapping to CPU/GPU memory More...
 
u64 getLevelAfterFullSlotBootstrap () const
 return the level right after (full slot) bootstrap More...
 
u64 getMinLevelForBootstrap () const
 return minimum level which is available to bootstrap More...
 
void bootstrap (const Ciphertext &ctxt, Ciphertext &ctxt_out, bool is_complex=false) const
 Bootstrap a Ciphertext with input range [-1, 1]. More...
 
void bootstrap (const Ciphertext &ctxt, Ciphertext &ctxt_out_real, Ciphertext &ctxt_out_imag) const
 Bootstrap a Ciphertext with two output Ciphertext, one for real part and the other for imaginary part. More...
 
void bootstrapExtended (const Ciphertext &ctxt, Ciphertext &ctxt_out, bool is_complex=false) const
 Bootstrap a Ciphertext with larger input range [-2^20, 2^20]. More...
 
void bootstrapExtended (const Ciphertext &ctxt, Ciphertext &ctxt_out_real, Ciphertext &ctxt_out_imag) const
 Bootstrap a Ciphertext with two output Ciphertext, one for real part and the other for imaginary part, with larger input range [-2^20, 2^20]. More...
 

Private Attributes

std::shared_ptr< BootstrapperImpl > impl_
 

Detailed Description

A class consisting of bootstrap and its related functions.

Constructor & Destructor Documentation

◆ Bootstrapper() [1/4]

HEaaN::Bootstrapper::Bootstrapper ( const HomEvaluator eval,
const u64  log_slots 
)
explicit

Constructs a class for boostrap. Pre-computation of bootstrapping constants is included.

Parameters
[in]evalHomEvaluator to be used for bootstrapping.
[in]log_slots

Without /p log_slots argument, it pre-compute the boot constants for full slots

◆ Bootstrapper() [2/4]

HEaaN::Bootstrapper::Bootstrapper ( const HomEvaluator eval)
explicit

◆ Bootstrapper() [3/4]

HEaaN::Bootstrapper::Bootstrapper ( const HomEvaluator eval,
const Context context_sparse,
const u64  log_slots 
)
explicit

Constructs a class for boostrap which can perform sparse secret encapsulation, using the same Parameter as eval. Includes pre-computation of bootstrapping constants.

Parameters
[in]evalHomEvaluator to be used for bootstrapping.
[in]context_sparseThe context constructed with the corresponding sparse parameter of which eval was constructed.
[in]log_slotsLogarithm (base 2) of the number of plaintext slots.

If the log_slots argument is not provided, the bootstrapping constants will be pre-computed for full slots.

Exceptions
RuntimeExceptionif context_sparse is not a context constructed with the corresponding sparse parameter of which eval was constructed. Please refer to SparseParameterPresetFor() in ParameterPreset.hpp for the sparse parameters.

◆ Bootstrapper() [4/4]

HEaaN::Bootstrapper::Bootstrapper ( const HomEvaluator eval,
const Context context_sparse 
)
explicit

Member Function Documentation

◆ bootstrap() [1/2]

void HEaaN::Bootstrapper::bootstrap ( const Ciphertext ctxt,
Ciphertext ctxt_out,
bool  is_complex = false 
) const

Bootstrap a Ciphertext with input range [-1, 1].

Parameters
[in]ctxt
[out]ctxt_out
[in]is_complexSet it to TRUE when the input ciphertext actually encrypting complex vectors.

Recover the level of Ciphertext.

Exceptions
RuntimeExceptionif level of ctxt is less than 3
RuntimeExceptionif ctxt has nonzero rescale counter.

◆ bootstrap() [2/2]

void HEaaN::Bootstrapper::bootstrap ( const Ciphertext ctxt,
Ciphertext ctxt_out_real,
Ciphertext ctxt_out_imag 
) const

Bootstrap a Ciphertext with two output Ciphertext, one for real part and the other for imaginary part.

Parameters
[in]ctxt
[out]ctxt_out_real
[out]ctxt_out_imag

Recover the level of Ciphertexts.

Exceptions
RuntimeExceptionif level of ctxt is less than 3
RuntimeExceptionif ctxt has nonzero rescale counter.

◆ bootstrapExtended() [1/2]

void HEaaN::Bootstrapper::bootstrapExtended ( const Ciphertext ctxt,
Ciphertext ctxt_out,
bool  is_complex = false 
) const

Bootstrap a Ciphertext with larger input range [-2^20, 2^20].

Parameters
[in]ctxt
[out]ctxt_out
[in]is_complexSet it to TRUE when the input ciphertext actually encrypting complex vectors.

Recover the level of Ciphertext. Note that this function is approximately two times slower than basic bootstrap function. Enabled only for FV and FG parameters.

Exceptions
RuntimeExceptionif level of ctxt is less than 4
RuntimeExceptionif ctxt has nonzero rescale counter.

◆ bootstrapExtended() [2/2]

void HEaaN::Bootstrapper::bootstrapExtended ( const Ciphertext ctxt,
Ciphertext ctxt_out_real,
Ciphertext ctxt_out_imag 
) const

Bootstrap a Ciphertext with two output Ciphertext, one for real part and the other for imaginary part, with larger input range [-2^20, 2^20].

Parameters
[in]ctxt
[out]ctxt_out_real
[out]ctxt_out_imag

Recover the level of Ciphertexts.

Exceptions
RuntimeExceptionif level of ctxt is less than 4
RuntimeExceptionif ctxt has nonzero rescale counter.

◆ getLevelAfterFullSlotBootstrap()

u64 HEaaN::Bootstrapper::getLevelAfterFullSlotBootstrap ( ) const

return the level right after (full slot) bootstrap

◆ getMinLevelForBootstrap()

u64 HEaaN::Bootstrapper::getMinLevelForBootstrap ( ) const

return minimum level which is available to bootstrap

◆ isBootstrapReady()

bool HEaaN::Bootstrapper::isBootstrapReady ( const u64  log_slots) const

Check whether bootstrap is available.

Parameters
[in]log_slots

Check whether bootstrapping constants are pre-computed. These constants are necessary for the process of bootstrapping.

◆ loadBootConstants()

void HEaaN::Bootstrapper::loadBootConstants ( const u64  log_slots,
const Device device 
) const

load the pre-computed data for bootstrapping to CPU/GPU memory

Parameters
[in]log_slots
[in]device

The pre-computed constants for bootstrapping are initially

Exceptions
RuntimeExceptionif boot constants are not pre-computed.

◆ makeBootConstants()

void HEaaN::Bootstrapper::makeBootConstants ( const u64  log_slots)

make the pre-computed data for bootstrapping

Parameters
[in]log_slots
Exceptions
RuntimeExceptionif log_slots > (full log slots of this parameter)

Member Data Documentation

◆ impl_

std::shared_ptr<BootstrapperImpl> HEaaN::Bootstrapper::impl_
private

The documentation for this class was generated from the following file: