Builder to help construct a context. More...
#include <Context.h>
Classes | |
struct | default_values |
Public Member Functions | |
ContextBuilder & | m (long m) |
Sets m the order of the cyclotomic polynomial. More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | p (long p) |
Sets p the prime number of the ciphertext space. More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | r (long r) |
Sets r the Hensel lifting parameter. More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, CKKS >::value > * = nullptr> | |
ContextBuilder & | precision (long precision) |
Sets precision the bit precision parameter. More... | |
ContextBuilder & | scale (double scale) |
Sets scale the scale parameter. More... | |
ContextBuilder & | stdev (double stdev) |
Sets stdev the standard deviation parameter. More... | |
ContextBuilder & | c (long c) |
Sets c the number of columns (a.k.a. digits) in the key switching matrices. More... | |
ContextBuilder & | gens (const std::vector< long > &gens) |
Sets gens the generators of the ZMStar group. More... | |
ContextBuilder & | ords (const std::vector< long > &ords) |
Sets ords the order of the corresponding generators in gens in ZmStar . More... | |
ContextBuilder & | bits (long bits) |
Sets the bit size of the primes in the modulus chain. More... | |
ContextBuilder & | skHwt (long skHwt) |
Sets the secret key Hamming weight. More... | |
ContextBuilder & | resolution (long bits) |
Sets the resolution for the modulus chain. More... | |
ContextBuilder & | bitsInSpecialPrimes (long bits) |
Sets the bit size of the special primes in the modulus chain. More... | |
ContextBuilder & | buildModChain (bool yesno) |
Sets a flag determining whether the modulus chain will be built. More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | mvec (const NTL::Vec< long > &mvec) |
Sets mvec the unique primes which are factors of m . More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | mvec (const std::vector< long > &mvec) |
Sets mvec the unique primes which are factors of m . More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | thinboot () |
Sets boostrapping to be thin . More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | thickboot () |
Sets boostrapping to be thick . More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | buildCache (bool yesno) |
Sets flag to choose that the cache for boostrapping will be built. More... | |
template<typename S = SCHEME, std::enable_if_t< std::is_same< S, BGV >::value > * = nullptr> | |
ContextBuilder & | bootstrappable (bool yesno=true) |
Sets a flag determining if the context will be bootstrappable. More... | |
Context | build () const |
Builds a Context object from the arguments stored in the ContextBuilder object. More... | |
Context * | buildPtr () const |
Builds a Context object from the arguments stored in the ContextBuilder object. More... | |
Static Public Attributes | |
static constexpr std::string_view | typeName = "ContextBuilder" |
Class label to be added to JSON serialization as object type information. More... | |
Friends | |
std::ostream & | operator (std::ostream &os, const ContextBuilder &cb) |
Detailed Description
template<typename SCHEME>
class helib::ContextBuilder< SCHEME >
Builder to help construct a context.
Member Function Documentation
◆ bits()
|
inline |
Sets the bit size of the primes in the modulus chain.
- Parameters
-
bits How many bits to make the modulus chain.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- The actual bit size that is set is typically higher than requested.
◆ bitsInSpecialPrimes()
|
inline |
Sets the bit size of the special primes in the modulus chain.
- Parameters
-
bits The bit size of the special primes in the modulus chain.
- Returns
- Reference to this
ContextBuilder
object.
◆ bootstrappable()
|
inline |
Sets a flag determining if the context will be bootstrappable.
- Parameters
-
yesno A bool
to determine whether the context will be bootstrappable.
- Returns
- Reference to this
ContextBuilder
object.
- Note
ContextBuilder
by default will not be bootstrappable.-
Only exists when the
SCHEME
isBGV
.
◆ build()
Context helib::ContextBuilder< SCHEME >::build |
Builds a Context
object from the arguments stored in the ContextBuilder
object.
- Returns
- A
Context
object.
◆ buildCache()
|
inline |
Sets flag to choose that the cache for boostrapping will be built.
- Parameters
-
yesno A bool
to determine whether the cache is built.
- Returns
- Reference to the
ContextBuilder
object.
- Note
-
Only exists when the
SCHEME
isBGV
.
◆ buildModChain()
|
inline |
Sets a flag determining whether the modulus chain will be built.
- Parameters
-
<tt>yesno</tt> A bool
to determine whether the modulus chain should be built.
- Returns
- Reference to the
ContextBuilder
object.
- Note
ContextBuilder
by default will build the modulus chain.
◆ buildPtr()
Context * helib::ContextBuilder< SCHEME >::buildPtr |
Builds a Context
object from the arguments stored in the ContextBuilder
object.
- Returns
- A raw pointer to a
Context
object.
◆ c()
|
inline |
Sets c
the number of columns (a.k.a. digits) in the key switching matrices.
- Parameters
-
c The number of columns in the key switching matrix.
- Returns
- Reference to the
ContextBuilder
object.
◆ gens()
|
inline |
Sets gens
the generators of the ZMStar
group.
- Parameters
-
gens A std::vector
containing the generators.
- Returns
- Reference to the
ContextBuilder
object.
◆ m()
|
inline |
Sets m
the order of the cyclotomic polynomial.
- Parameters
-
m The order of the cyclotomic polynomial.
- Returns
- Reference to this
ContextBuilder
object.
◆ mvec() [1/2]
|
inline |
Sets mvec
the unique primes which are factors of m
.
- Parameters
-
mvec An NTL::Vec
of primes factors.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isBGV
.
◆ mvec() [2/2]
|
inline |
Sets mvec
the unique primes which are factors of m
.
- Parameters
-
mvec A std::vector
of primes factors.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isBGV
.
◆ ords()
|
inline |
Sets ords
the order of the corresponding generators in gens
in ZmStar
.
- Parameters
-
ords A std::vector
containing the orders ofgens
. The order taken is the absolute value; a negative inords
represents a bad dimension.
- Returns
- Reference to the
ContextBuilder
object.
◆ p()
|
inline |
Sets p
the prime number of the ciphertext space.
- Parameters
-
p The prime number of the plaintext space.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isBGV
.
◆ precision()
|
inline |
Sets precision
the bit precision parameter.
- Parameters
-
precision The bit precision parameter.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isCKKS
.
◆ r()
|
inline |
Sets r
the Hensel lifting parameter.
- Parameters
-
r The Hensel lifting parameter.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isBGV
.
◆ resolution()
|
inline |
Sets the resolution for the modulus chain.
- Parameters
-
bits How many bit size of resolution.
- Returns
- Reference to the
ContextBuilder
object.
◆ scale()
|
inline |
Sets scale
the scale parameter.
- Parameters
-
scale The bit scale parameter.
- Returns
- Reference to the
ContextBuilder
object.
◆ skHwt()
|
inline |
Sets the secret key Hamming weight.
- Parameters
-
bits The secret key Hamming weight.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- If the Hamming weight is
0
(default) then a "dense" key will be generated.
◆ stdev()
|
inline |
Sets stdev
the standard deviation parameter.
- Parameters
-
stdev The standard deviation parameter.
- Returns
- Reference to the
ContextBuilder
object.
◆ thickboot()
|
inline |
Sets boostrapping to be thick
.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isBGV
.
◆ thinboot()
|
inline |
Sets boostrapping to be thin
.
- Returns
- Reference to the
ContextBuilder
object.
- Note
- Only exists when the
SCHEME
isBGV
.
Friends And Related Function Documentation
◆ operator
|
friend |
Member Data Documentation
◆ typeName
|
staticconstexpr |
Class label to be added to JSON serialization as object type information.