Template Class HEOperator< Scheme::CKKS >

Nested Relationships

Nested Types

Inheritance Relationships

Derived Types

Class Documentation

template<>
class HEOperator<Scheme::CKKS>

HEOperator is responsible for performing homomorphic operations on encrypted data, such as addition, subtraction, multiplication, and other functions.

The HEOperator class is initialized with encryption parameters and provides various functions for performing operations on ciphertexts, including CKKS scheme. It supports both in-place and out-of-place operations, as well as asynchronous processing using CUDA streams.

Subclassed by heongpu::HEArithmeticOperator< Scheme::CKKS >, heongpu::HELogicOperator< Scheme::CKKS >

Public Functions

void add(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Adds two ciphertexts and stores the result in the output.

Parameters:
  • input1 – First input ciphertext to be added.

  • input2 – Second input ciphertext to be added.

  • outputCiphertext where the result of the addition is stored.

inline void add_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Adds the second ciphertext to the first ciphertext, modifying the first ciphertext with the result.

Parameters:
  • input1 – The ciphertext to which the value of input2 will be added.

  • input2 – The ciphertext to be added to input1.

void sub(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Subtracts the second ciphertext from the first and stores the result in the output.

Parameters:
  • input1 – First input ciphertext (minuend).

  • input2 – Second input ciphertext (subtrahend).

  • outputCiphertext where the result of the subtraction is stored.

inline void sub_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Subtracts the second ciphertext from the first, modifying the first ciphertext with the result.

Parameters:
  • input1 – The ciphertext from which input2 will be subtracted.

  • input2 – The ciphertext to subtract from input1.

void negate(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Negates a ciphertext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be negated.

  • outputCiphertext where the result of the negation is stored.

inline void negate_inplace(Ciphertext<Scheme::CKKS> &input1, const ExecutionOptions &options = ExecutionOptions())

Negates a ciphertext in-place, modifying the input ciphertext.

Parameters:

input1Ciphertext to be negated.

inline void add_plain(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Adds a ciphertext and a plaintext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be added.

  • input2 – Input plaintext to be added.

  • outputCiphertext where the result of the addition is stored.

inline void add_plain_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Adds a plaintext to a ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext to which the plaintext will be added.

  • input2Plaintext to be added to the ciphertext.

inline void add_plain(Ciphertext<Scheme::CKKS> &input1, double input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Adds a ciphertext and a plaintext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be added.

  • input2 – Input constant plaintext(double) to be added.

  • outputCiphertext where the result of the addition is stored.

inline void add_plain_inplace(Ciphertext<Scheme::CKKS> &input1, double input2, const ExecutionOptions &options = ExecutionOptions())

Adds a plaintext to a ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext to which the plaintext will be added.

  • input2 – Input constant plaintext(double) to be added.

inline void sub_plain(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Subtracts a plaintext from a ciphertext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext (minuend).

  • input2 – Input plaintext (subtrahend).

  • outputCiphertext where the result of the subtraction is stored.

inline void sub_plain_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Subtracts a plaintext from a ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext from which the plaintext will be subtracted.

  • input2Plaintext to be subtracted from the ciphertext.

inline void sub_plain(Ciphertext<Scheme::CKKS> &input1, double input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Subtracts a plaintext from a ciphertext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext (minuend).

  • input2 – Input plaintext (subtrahend).

  • outputCiphertext where the result of the subtraction is stored.

inline void sub_plain_inplace(Ciphertext<Scheme::CKKS> &input1, double input2, const ExecutionOptions &options = ExecutionOptions())

Subtracts a plaintext from a ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext from which the plaintext will be subtracted.

  • input2Plaintext to be subtracted from the ciphertext.

inline void add_plain_v2(Ciphertext<Scheme::CKKS> &input1, Complex64 c, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Adds a complex constant to a ciphertext and stores the result in the output (v2 version).

Parameters:
  • input1 – Input ciphertext to be added.

  • c – Complex constant to be added (not multiplied by scale).

  • outputCiphertext where the result of the addition is stored.

inline void multiply(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Multiplies two ciphertexts and stores the result in the output.

Parameters:
  • input1 – First input ciphertext to be multiplied.

  • input2 – Second input ciphertext to be multiplied.

  • outputCiphertext where the result of the multiplication is stored.

inline void multiply_inplace(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Multiplies two ciphertexts in-place, modifying the first ciphertext.

Parameters:
  • input1Ciphertext to be multiplied, and where the result will be stored.

  • input2 – Second input ciphertext to be multiplied.

inline void multiply_plain(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Multiplies a ciphertext and a plaintext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be multiplied.

  • input2 – Input plaintext to be multiplied.

  • outputCiphertext where the result of the multiplication is stored.

inline void multiply_plain_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const ExecutionOptions &options = ExecutionOptions())

Multiplies a plaintext with a ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext to be multiplied by the plaintext, and where the result will be stored.

  • input2Plaintext to be multiplied with the ciphertext.

inline void multiply_plain(Ciphertext<Scheme::CKKS> &input1, double input2, Ciphertext<Scheme::CKKS> &output, double scale, const ExecutionOptions &options = ExecutionOptions())

Multiplies a ciphertext and a plaintext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be multiplied.

  • input2 – Input constant plaintext(double) to be multiplied.

  • outputCiphertext where the result of the multiplication is stored.

inline void multiply_plain_inplace(Ciphertext<Scheme::CKKS> &input1, double input2, double scale, const ExecutionOptions &options = ExecutionOptions())

Multiplies a plaintext with a ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext to be multiplied by the plaintext, and where the result will be stored.

  • input2 – Input constant plaintext(double) to be multiplied.

inline void multiply_plain_v2(Ciphertext<Scheme::CKKS> &input1, Complex64 c, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Multiplies a ciphertext by a complex constant and stores the result in the output (v2 version).

Parameters:
  • input1 – Input ciphertext to be multiplied.

  • c – Complex constant to multiply with the ciphertext.

  • outputCiphertext where the result of the multiplication is stored.

inline void scale_up(Ciphertext<Scheme::CKKS> &input, double scale, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Scales up a ciphertext by multiplying its scale factor.

Parameters:
  • input – Input ciphertext to be scaled up.

  • scale – Scaling factor to multiply with the ciphertext’s current scale.

  • outputCiphertext where the scaled result is stored.

inline void mult_i(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Multiplies a ciphertext by the imaginary unit i and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be multiplied by i.

  • outputCiphertext where the result is stored.

inline void div_i(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Divides a ciphertext by the imaginary unit i and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be divided by i.

  • outputCiphertext where the result is stored.

inline void relinearize_inplace(Ciphertext<Scheme::CKKS> &input1, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())

Performs in-place relinearization of the given ciphertext using the provided relin key.

Parameters:
  • input1Ciphertext to be relinearized.

  • relin_key – The Relinkey object used for relinearization.

inline void rotate_rows(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &galois_key, int shift, const ExecutionOptions &options = ExecutionOptions())

Rotates the rows of a ciphertext by a given shift value and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be rotated.

  • outputCiphertext where the result of the rotation is stored.

  • galois_key – Galois key used for the rotation operation.

  • shift – Number of positions to shift the rows.

inline void rotate_rows_inplace(Ciphertext<Scheme::CKKS> &input1, Galoiskey<Scheme::CKKS> &galois_key, int shift, const ExecutionOptions &options = ExecutionOptions())

Rotates the rows of a ciphertext in-place by a given shift value, modifying the input ciphertext.

Parameters:
  • input1Ciphertext to be rotated.

  • galois_key – Galois key used for the rotation operation.

  • shift – Number of positions to shift the rows.

inline void apply_galois(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &galois_key, int galois_elt, const ExecutionOptions &options = ExecutionOptions())

Applies a Galois automorphism to the ciphertext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to which the Galois operation will be applied.

  • outputCiphertext where the result of the Galois operation is stored.

  • galois_key – Galois key used for the operation.

  • galois_elt – The Galois element to apply.

inline void apply_galois_inplace(Ciphertext<Scheme::CKKS> &input1, Galoiskey<Scheme::CKKS> &galois_key, int galois_elt, const ExecutionOptions &options = ExecutionOptions())

Applies a Galois automorphism to the ciphertext in-place, modifying the input ciphertext.

Parameters:
  • input1Ciphertext to which the Galois operation will be applied.

  • galois_key – Galois key used for the operation.

  • galois_elt – The Galois element to apply.

inline void keyswitch(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Switchkey<Scheme::CKKS> &switch_key, const ExecutionOptions &options = ExecutionOptions())

Performs key switching on the ciphertext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be key-switched.

  • outputCiphertext where the result of the key switching is stored.

  • switch_key – Switch key used for the key switching operation.

inline void conjugate(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &conjugate_key, const ExecutionOptions &options = ExecutionOptions())

Performs conjugation on the ciphertext and stores the result in the output.

Parameters:
  • input1 – Input ciphertext to be conjugated.

  • outputCiphertext where the result of the conjugation is stored.

  • conjugate_key – Switch key used for the conjugation operation.

inline void rescale_inplace(Ciphertext<Scheme::CKKS> &input1, const ExecutionOptions &options = ExecutionOptions())

Rescales a ciphertext in-place, modifying the input ciphertext.

Parameters:

input1Ciphertext to be rescaled.

inline void mod_drop(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Drop the last modulus of ciphertext and stores the result in the output.(CKKS)

Parameters:
  • input1 – Input ciphertext from which last modulus will be dropped.

  • outputCiphertext where the result of the modulus drop is stored.

inline void mod_drop(Plaintext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &output, const ExecutionOptions &options = ExecutionOptions())

Drop the last modulus of plaintext and stores the result in the output.(CKKS)

Parameters:
  • input1 – Input plaintext from which modulus will be dropped.

  • outputPlaintext where the result of the modulus drop is stored.

inline void mod_drop_inplace(Plaintext<Scheme::CKKS> &input1, const ExecutionOptions &options = ExecutionOptions())

Drop the last modulus of plaintext in-place on a plaintext, modifying the input plaintext.

Parameters:

input1Plaintext to perform modulus dropping on.

inline void mod_drop_inplace(Ciphertext<Scheme::CKKS> &input1, const ExecutionOptions &options = ExecutionOptions())

Drop the last modulus of ciphertext in-place on a ciphertext, modifying the input ciphertext.

Parameters:

input1Ciphertext to perform modulus dropping on.

HEOperator() = default
HEOperator(const HEOperator &copy) = default
HEOperator(HEOperator &&source) = default
HEOperator &operator=(const HEOperator &assign) = default
HEOperator &operator=(HEOperator &&assign) = default

Protected Functions

HEOperator(HEContext<Scheme::CKKS> context, HEEncoder<Scheme::CKKS> &encoder)

Construct a new HEOperator object with the given parameters.

Parameters:

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

void add_plain_ckks(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void add_plain_ckks_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const cudaStream_t stream)
void add_constant_plain_ckks(Ciphertext<Scheme::CKKS> &input1, double input2, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void add_constant_plain_ckks_inplace(Ciphertext<Scheme::CKKS> &input1, double input2, const cudaStream_t stream)
void sub_plain_ckks(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void sub_plain_ckks_inplace(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, const cudaStream_t stream)
void sub_constant_plain_ckks(Ciphertext<Scheme::CKKS> &input1, double input2, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void sub_constant_plain_ckks_inplace(Ciphertext<Scheme::CKKS> &input1, double input2, const cudaStream_t stream)
void add_constant_plain_ckks_v2(Ciphertext<Scheme::CKKS> &input1, Complex64 c, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void multiply_const_plain_ckks_v2(Ciphertext<Scheme::CKKS> &input1, Complex64 c, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void scale_up_ckks(Ciphertext<Scheme::CKKS> &input, double scale, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void mult_i_ckks(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void div_i_ckks(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void multiply_ckks(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void multiply_plain_ckks(Ciphertext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &input2, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void multiply_const_plain_ckks(Ciphertext<Scheme::CKKS> &input1, double input2, Ciphertext<Scheme::CKKS> &output, double scale, const cudaStream_t stream)
void relinearize_seal_method_inplace_ckks(Ciphertext<Scheme::CKKS> &input1, Relinkey<Scheme::CKKS> &relin_key, const cudaStream_t stream)
void relinearize_external_product_method2_inplace_ckks(Ciphertext<Scheme::CKKS> &input1, Relinkey<Scheme::CKKS> &relin_key, const cudaStream_t stream)
void rotate_ckks_method_I(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &galois_key, int shift, const cudaStream_t stream)
void rotate_ckks_method_II(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &galois_key, int shift, const cudaStream_t stream)
void apply_galois_ckks_method_I(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &galois_key, int galois_elt, const cudaStream_t stream)
void apply_galois_ckks_method_II(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &galois_key, int galois_elt, const cudaStream_t stream)
void switchkey_ckks_method_I(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Switchkey<Scheme::CKKS> &switch_key, const cudaStream_t stream)
void switchkey_ckks_method_II(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Switchkey<Scheme::CKKS> &switch_key, const cudaStream_t stream)
void conjugate_ckks_method_I(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &conjugate_key, const cudaStream_t stream)
void conjugate_ckks_method_II(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, Galoiskey<Scheme::CKKS> &conjugate_key, const cudaStream_t stream)
void rescale_inplace_ckks_leveled(Ciphertext<Scheme::CKKS> &input1, const cudaStream_t stream)
void mod_drop_ckks_leveled(Ciphertext<Scheme::CKKS> &input1, Ciphertext<Scheme::CKKS> &output, const cudaStream_t stream)
void mod_drop_ckks_plaintext(Plaintext<Scheme::CKKS> &input1, Plaintext<Scheme::CKKS> &output, const cudaStream_t stream)
void mod_drop_ckks_plaintext_inplace(Plaintext<Scheme::CKKS> &input1, const cudaStream_t stream)
void mod_drop_ckks_leveled_inplace(Ciphertext<Scheme::CKKS> &input1, const cudaStream_t stream)
Plaintext<Scheme::CKKS> operator_plaintext(cudaStream_t stream = cudaStreamDefault)
Plaintext<Scheme::CKKS> operator_from_plaintext(Plaintext<Scheme::CKKS> &input, cudaStream_t stream = cudaStreamDefault)
Ciphertext<Scheme::CKKS> operator_ciphertext(double scale, cudaStream_t stream = cudaStreamDefault)
Ciphertext<Scheme::CKKS> operator_from_ciphertext(Ciphertext<Scheme::CKKS> &input, cudaStream_t stream = cudaStreamDefault)
std::vector<int> rotation_index_generator(uint64_t n, int K, int M)
void quick_ckks_encoder_vec_complex(Complex64 *input, Data64 *output, const double scale, int rns_count)
void quick_ckks_encoder_constant_complex(Complex64 input, Data64 *output, const double scale)
void quick_ckks_encoder_constant_double(double input, Data64 *output, const double scale)
void quick_ckks_encoder_constant_integer(std::int64_t input, Data64 *output, const double scale)
std::vector<heongpu::DeviceVector<Data64>> encode_V_matrixs(Vandermonde &vandermonde, const double scale, int rns_count)
std::vector<heongpu::DeviceVector<Data64>> encode_V_inv_matrixs(Vandermonde &vandermonde, const double scale, int rns_count)
std::vector<heongpu::DeviceVector<Data64>> encode_V_matrixs_v2(Vandermonde &vandermonde, int start_level)
std::vector<heongpu::DeviceVector<Data64>> encode_V_inv_matrixs_v2(Vandermonde &vandermonde, int start_level)
Polynomial generate_eval_mod_poly(const EvalModConfig &config, int max_deg)
Ciphertext<Scheme::CKKS> multiply_matrix(Ciphertext<Scheme::CKKS> &cipher, std::vector<heongpu::DeviceVector<Data64>> &matrix, std::vector<std::vector<std::vector<int>>> &diags_matrices_bsgs_, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> multiply_matrix_v2(Ciphertext<Scheme::CKKS> &cipher, std::vector<heongpu::DeviceVector<Data64>> &matrix, std::vector<std::vector<std::vector<int>>> &diags_matrices_bsgs_, std::vector<std::vector<int>> &diags_matrices_bsgs_rot_n1_, std::vector<std::vector<int>> &diags_matrices_bsgs_rot_n2_, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> multiply_matrix_less_memory(Ciphertext<Scheme::CKKS> &cipher, std::vector<heongpu::DeviceVector<Data64>> &matrix, std::vector<std::vector<std::vector<int>>> &diags_matrices_bsgs_, std::vector<std::vector<std::vector<int>>> &real_shift, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
std::vector<Ciphertext<Scheme::CKKS>> coeff_to_slot(Ciphertext<Scheme::CKKS> &cipher, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
std::vector<Ciphertext<Scheme::CKKS>> coeff_to_slot(Ciphertext<Scheme::CKKS> &cipher, Galoiskey<Scheme::CKKS> &galois_key, CKKSEncodingTransformContext &transform_context, const ExecutionOptions &options = ExecutionOptions())
std::vector<Ciphertext<Scheme::CKKS>> coeff_to_slot_v2(Ciphertext<Scheme::CKKS> &cipher, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> solo_coeff_to_slot(Ciphertext<Scheme::CKKS> &cipher, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> slot_to_coeff(Ciphertext<Scheme::CKKS> &cipher0, Ciphertext<Scheme::CKKS> &cipher1, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> slot_to_coeff(Ciphertext<Scheme::CKKS> &cipher0, Ciphertext<Scheme::CKKS> &cipher1, Galoiskey<Scheme::CKKS> &galois_key, CKKSEncodingTransformContext &transform_context, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> slot_to_coeff_v2(Ciphertext<Scheme::CKKS> &cipher0, Ciphertext<Scheme::CKKS> &cipher1, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> solo_slot_to_coeff(Ciphertext<Scheme::CKKS> &cipher, Galoiskey<Scheme::CKKS> &galois_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> mod_up_from_q0(Ciphertext<Scheme::CKKS> &cipher, Switchkey<Scheme::CKKS> *swk_dense_to_sparse = nullptr, Switchkey<Scheme::CKKS> *swk_sparse_to_dense = nullptr, const ExecutionOptions &options = ExecutionOptions())

Raises modulus from Q0 to full Q with optional key switching.

Ciphertext<Scheme::CKKS> exp_scaled(Ciphertext<Scheme::CKKS> &cipher, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> exp_taylor_approximation(Ciphertext<Scheme::CKKS> &cipher, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> eval_mod(Ciphertext<Scheme::CKKS> &cipher, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())
void gen_power(std::unordered_map<int, Ciphertext<Scheme::CKKS>> &cipher, int power, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> evaluate_poly(Ciphertext<Scheme::CKKS> &cipher, double target_scale, const Polynomial &pol, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options)
Ciphertext<Scheme::CKKS> evaluate_poly_from_polynomial_basis(double target_scale, int target_level, const Polynomial &pol, std::unordered_map<int, Ciphertext<Scheme::CKKS>> &powered_ciphers, const ExecutionOptions &options = ExecutionOptions())
Ciphertext<Scheme::CKKS> evaluate_poly_recurse(int target_level, double target_scale, const Polynomial &pol, int log_split, std::unordered_map<int, Ciphertext<Scheme::CKKS>> &powered_ciphers, Relinkey<Scheme::CKKS> &relin_key, const ExecutionOptions &options = ExecutionOptions())
inline DeviceVector<Data64> fast_single_hoisting_rotation_ckks(Ciphertext<Scheme::CKKS> &input1, std::vector<int> &bsgs_shift, int n1, Galoiskey<Scheme::CKKS> &galois_key, const cudaStream_t stream)
DeviceVector<Data64> fast_single_hoisting_rotation_ckks_method_I(Ciphertext<Scheme::CKKS> &first_cipher, std::vector<int> &bsgs_shift, int n1, Galoiskey<Scheme::CKKS> &galois_key, const cudaStream_t stream)
DeviceVector<Data64> fast_single_hoisting_rotation_ckks_method_II(Ciphertext<Scheme::CKKS> &first_cipher, std::vector<int> &bsgs_shift, int n1, Galoiskey<Scheme::CKKS> &galois_key, const cudaStream_t stream)

Protected Attributes

HEContext<Scheme::CKKS> context_
DeviceVector<int> new_prime_locations_
DeviceVector<int> new_input_locations_
int *new_prime_locations
int *new_input_locations
double scale_boot_
bool boot_context_generated_ = false
int CtoS_piece_
int StoC_piece_
int taylor_number_
bool less_key_mode_
int CtoS_level_
int StoC_level_
EncodingMatrixConfig cts_config_
EncodingMatrixConfig stc_config_
EvalModConfig eval_mod_config_
Polynomial sine_poly_
std::vector<int> key_indexs_
std::vector<heongpu::DeviceVector<Data64>> V_matrixs_rotated_encoded_
std::vector<heongpu::DeviceVector<Data64>> V_inv_matrixs_rotated_encoded_
std::vector<std::vector<int>> V_matrixs_index_
std::vector<std::vector<int>> V_inv_matrixs_index_
std::vector<std::vector<std::vector<int>>> diags_matrices_bsgs_
std::vector<std::vector<std::vector<int>>> diags_matrices_inv_bsgs_
std::vector<std::vector<std::vector<int>>> real_shift_n2_bsgs_
std::vector<std::vector<std::vector<int>>> real_shift_n2_inv_bsgs_
std::vector<std::vector<int>> diags_matrices_bsgs_rot_n1_
std::vector<std::vector<int>> diags_matrices_inv_bsgs_rot_n1_
std::vector<std::vector<int>> diags_matrices_bsgs_rot_n2_
std::vector<std::vector<int>> diags_matrices_inv_bsgs_rot_n2_
int slot_count_
int log_slot_count_
double two_pow_64_
std::shared_ptr<DeviceVector<int>> reverse_order_
std::shared_ptr<DeviceVector<Complex64>> special_ifft_roots_table_
DeviceVector<Data64> encoded_complex_minus_iover2_
DeviceVector<Data64> encoded_complex_i_
DeviceVector<Data64> encoded_complex_minus_iscale_
DeviceVector<Data64> encoded_complex_iscaleoverr_
template<>
class Polynomial

Public Functions

inline Polynomial()
Polynomial(int max_deg, const std::vector<Complex64> &coeffs, bool lead = false, PolyType type = PolyType::CHEBYSHEV, double a = 0.0, double b = 0.0)
int degree() const
int depth() const
std::pair<Polynomial, Polynomial> split_coeffs(int split) const

Public Members

PolyType type_
int max_deg_
std::vector<Complex64> coeffs_
bool lead_
double a_
double b_
template<>
class Vandermonde

Public Functions

Vandermonde(const int poly_degree, const int CtoS_piece, const int StoC_piece, const bool less_key_mode)
Vandermonde(const int poly_degree, const int CtoS_piece, const int StoC_piece, const double CtoS_Scaling, const double StoC_Scaling, const float CtoS_bsgs_ratio, const float StoC_bsgs_ratio)
void generate_E_diagonals_index()
void generate_E_inv_diagonals_index()
void split_E()
void split_E_inv()
void generate_E_diagonals()
void generate_E_inv_diagonals()
void generate_V_n_lists()
void generate_V_n_lists_v2(float CtoS_bsgs_ratio, float StoC_bsgs_ratio)
void generate_pre_comp_V()
void generate_pre_comp_V_inv()
void generate_pre_comp_V_v2()
void generate_pre_comp_V_inv_v2()
void generate_key_indexs(const bool less_key_mode)
void generate_key_indexs_v2()
Vandermonde() = delete