Class LeveledSHEBGVRNS

Inheritance Relationships

Base Type

Class Documentation

class lbcrypto::LeveledSHEBGVRNS : public lbcrypto::LeveledSHERNS

Inheritence diagram for lbcrypto::LeveledSHEBGVRNS:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "3" [label="lbcrypto::LeveledSHEBase< DCRTPoly >" tooltip="lbcrypto::LeveledSHEBase< DCRTPoly >"]
    "1" [label="lbcrypto::LeveledSHEBGVRNS" tooltip="lbcrypto::LeveledSHEBGVRNS" fillcolor="#BFBFBF"]
    "2" [label="lbcrypto::LeveledSHERNS" tooltip="lbcrypto::LeveledSHERNS"]
    "1" -> "2" [dir=forward tooltip="public-inheritance"]
    "2" -> "3" [dir=forward tooltip="public-inheritance"]
}

Collaboration diagram for lbcrypto::LeveledSHEBGVRNS:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "3" [label="lbcrypto::LeveledSHEBase< DCRTPoly >" tooltip="lbcrypto::LeveledSHEBase< DCRTPoly >"]
    "1" [label="lbcrypto::LeveledSHEBGVRNS" tooltip="lbcrypto::LeveledSHEBGVRNS" fillcolor="#BFBFBF"]
    "2" [label="lbcrypto::LeveledSHERNS" tooltip="lbcrypto::LeveledSHERNS"]
    "1" -> "2" [dir=forward tooltip="public-inheritance"]
    "2" -> "3" [dir=forward tooltip="public-inheritance"]
}

BGV implementation of the leveled SHE operations in the RNS representation: modulus switching with the plaintext-modulus correction and the level/depth adjustments that track the scaling factor modulo t for FLEXIBLEAUTO and FLEXIBLEAUTOEXT.

Public Functions

virtual ~LeveledSHEBGVRNS() = default
virtual uint32_t FindAutomorphismIndex(uint32_t index, uint32_t m) const override

Finds the automorphism index corresponding to a rotation index for a power-of-two cyclotomic order.

Parameters
  • index – the rotation index.

  • m – the cyclotomic order.

Returns

the automorphism index.

virtual void ModReduceInternalInPlace(Ciphertext<DCRTPoly> &ciphertext, size_t levels) const override

Method for BGV modulus switching in-place: drops the last levels towers, multiplying by the inverses of the dropped moduli and correcting the result so that it stays congruent modulo the plaintext modulus t. The level is increased and the noise scale degree decreased by levels; for FLEXIBLEAUTO and FLEXIBLEAUTOEXT the scaling factor modulo t is divided by the dropped moduli.

ciphertext will have modulus reduction performed in-place.

Parameters
  • ciphertext – is the ciphertext to perform modreduce on.

  • levels – the number of towers to drop (must be smaller than the number of towers).

virtual void LevelReduceInternalInPlace(Ciphertext<DCRTPoly> &ciphertext, size_t levels) const override

Drops the last levels towers of the ciphertext without changing the underlying plaintext and increases the level accordingly.

Parameters
  • ciphertext – is the ciphertext to be level reduced in-place.

  • levels – the number of towers to drop.

void EvalMultCoreInPlace(Ciphertext<DCRTPoly> &ciphertext, NativeInteger constant) const

Multiplies all polynomials of the ciphertext by an integer constant and increases the noise scale degree by 1; for FLEXIBLEAUTO and FLEXIBLEAUTOEXT the scaling factor modulo t is multiplied by the constant.

Parameters
  • ciphertext – the input/output ciphertext.

  • constant – the integer to multiply by.

void EvalMultInPlace(Ciphertext<DCRTPoly> &ciphertext, ConstPlaintext &plaintext) const override

In-place homomorphic multiplication of a ciphertext by a plaintext; for FLEXIBLEAUTO and FLEXIBLEAUTOEXT the scaling factor modulo t of the result is set to the square of the ciphertext scaling factor.

Parameters
  • ciphertext – the input/output ciphertext.

  • plaintext – the input plaintext.

virtual void AdjustLevelsAndDepthInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override

Brings two ciphertexts to the same level and noise scale degree for addition or subtraction. The ciphertext at the lower level is multiplied by the ratio of the scaling factors (modulo t) and modulus switched / level reduced as needed; at the same level the ciphertext of lower depth is multiplied by its own scaling factor.

Parameters
  • ciphertext1 – first input/output ciphertext.

  • ciphertext2 – second input/output ciphertext.

virtual void AdjustLevelsAndDepthToOneInPlace(Ciphertext<DCRTPoly> &ciphertext1, Ciphertext<DCRTPoly> &ciphertext2) const override

Brings two ciphertexts to the same level and to noise scale degree 1 for multiplication: calls AdjustLevelsAndDepthInPlace() and then modulus switches both ciphertexts once if they are at degree 2.

Parameters
  • ciphertext1 – first input/output ciphertext.

  • ciphertext2 – second input/output ciphertext.

template<class Archive>
inline void save(Archive &ar) const
template<class Archive>
inline void load(Archive &ar)
inline std::string SerializedObjectName() const