Template Class DiscreteGaussianGeneratorImpl

Template Parameter Order

  1. typename VecType

Class Documentation

template<typename VecType>
class lbcrypto::DiscreteGaussianGeneratorImpl

The class for Discrete Gaussion Distribution generator.

Public Functions

explicit DiscreteGaussianGeneratorImpl(double std = 1.0)

Basic constructor for specifying distribution parameter and modulus.

Parameters
  • modulus – The modulus to use to generate discrete values.

  • std – The standard deviation for this Gaussian Distribution.

~DiscreteGaussianGeneratorImpl() = default

Destructor.

bool IsInitialized() const

Check if the gaussian generator has been initialized with a standard deviation.

void Initialize()

Initializes the generator.

double GetStd() const

Returns the standard deviation of the generator.

Returns

The analytically obtained standard deviation of the generator.

void SetStd(double std)

Sets the standard deviation of the generator.

Parameters

std – The analytic standard deviation of the generator.

int32_t GenerateInt() const

Returns a generated signed integer. Uses Peikert’s Inversion Method.

Returns

a value generated with the distribution.

std::shared_ptr<int64_t> GenerateIntVector(uint32_t size) const

Returns a generated integer vector. Uses Peikert’s inversion method.

Parameters

size – The number of values to return.

Returns

A pointer to an array of integer values generated with the distribution.

VecType::Integer GenerateInteger(const typename VecType::Integer &modulus) const

Returns a generated integer. Uses Peikert’s inversion method.

Returns

A random value within this Discrete Gaussian Distribution.

VecType GenerateVector(uint32_t size, const typename VecType::Integer &modulus) const

Generates a vector of random values within this Discrete Gaussian Distribution. Uses Peikert’s inversion method.

Parameters
  • size – The number of values to return.

  • modulus – modulus of the polynomial ring.

Returns

The vector of values within this Discrete Gaussian Distribution.

VecType::Integer GenerateInteger(double mean, double stddev, size_t n, const typename VecType::Integer &modulus) const

Returns a generated integer. Uses rejection method.

Parameters
  • mean – center of discrete Gaussian distribution.

  • stddev – standard deviatin of discrete Gaussian distribution.

  • n – is ring dimension param modulus modulus

Returns

A random value within this Discrete Gaussian Distribution.

int32_t GenerateInteger(double mean, double stddev, size_t n) const

Returns a generated integer. Uses rejection method.

Parameters
  • mean – center of discrete Gaussian distribution.

  • stddev – standard deviatin of discrete Gaussian distribution.

  • n – is ring dimension

Returns

A random value within this Discrete Gaussian Distribution.

Public Static Functions

static int64_t GenerateIntegerKarney(double mean, double stddev)

Returns a generated integer (int32_t). Uses rejection method.

Returns a generated integer. Uses Karney’s method defined as Algorithm D in https://arxiv.org/pdf/1303.6257.pdf

Parameters
  • mean – center of discrecte Gaussian distribution.

  • stddev – standard deviatin of discrete Gaussian distribution.

  • mean – center of discrecte Gaussian distribution.

  • stddev – standard deviation of discrete Gaussian distribution.

Returns

A random value within this Discrete Gaussian Distribution.

Returns

A random value within this Discrete Gaussian Distribution.