1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use *;
use ;
use *;
///
/// Contains the implementation of the rounded rescaling operations used
/// during BFV multiplication and modulus-switching.
///
///
/// Contains the implementation of the rounded rescaling operations used
/// during BGV modulus-switching.
///
///
/// Contains a convenience-wrapper around the basic RNS conversion from
/// [`bconv`], which preserves some of the RNS factors without recomputing
/// them.
///
///
/// Contains the main implementation of the RNS base conversion.
///
///
/// Trait for any map `Zq -> Zq'` for (usually composite) `q, q'`.
///
/// In the normal case that `q, q'` are composite, the input and output
/// are given/expected to be returned in RNS resp. CRT form, i.e. `x in Zq`
/// is represented by `(x mod p)_{p | q}`.
///
/// # Standard use case
///
/// The main use case for this are cases where `q, q'` are huge (do not fit into
/// basic integers) and the maps can be efficiently computed without computing the
/// representatives modulo `q` resp. `q'`. This is in particular possible for
/// "approximate versions" of rounding or rescaling, that are important during
/// RLWE-based HE.
///
/// When we then have an object representing such a map, we can pass it to
/// [`perform_rns_op()`] or similar functions. This way, we can perform some
/// operations on double-RNS-represented ring element very easily and efficiently
/// (without arbitrary-precision arithmetic).
///
/// [`perform_rns_op()`]: crate::ciphertext_ring::perform_rns_op()
///