1use crate::{
2 layouts::{Backend, Scratch, VecZnxBigOwned, VecZnxBigToMut, VecZnxBigToRef, VecZnxToMut, VecZnxToRef},
3 source::Source,
4};
5
6pub trait VecZnxBigFromSmall<B: Backend> {
7 fn vec_znx_big_from_small<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
8 where
9 R: VecZnxBigToMut<B>,
10 A: VecZnxToRef;
11}
12
13pub trait VecZnxBigAlloc<B: Backend> {
15 fn vec_znx_big_alloc(&self, cols: usize, size: usize) -> VecZnxBigOwned<B>;
16}
17
18pub trait VecZnxBigBytesOf {
20 fn bytes_of_vec_znx_big(&self, cols: usize, size: usize) -> usize;
21}
22
23pub trait VecZnxBigFromBytes<B: Backend> {
26 fn vec_znx_big_from_bytes(&self, cols: usize, size: usize, bytes: Vec<u8>) -> VecZnxBigOwned<B>;
27}
28
29#[allow(clippy::too_many_arguments)]
30pub trait VecZnxBigAddNormal<B: Backend> {
41 fn vec_znx_big_add_normal<R: VecZnxBigToMut<B>>(
42 &self,
43 base2k: usize,
44 res: &mut R,
45 res_col: usize,
46 k: usize,
47 source: &mut Source,
48 sigma: f64,
49 bound: f64,
50 );
51}
52
53pub trait VecZnxBigAdd<B: Backend> {
54 fn vec_znx_big_add<R, A, C>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
56 where
57 R: VecZnxBigToMut<B>,
58 A: VecZnxBigToRef<B>,
59 C: VecZnxBigToRef<B>;
60}
61
62pub trait VecZnxBigAddInplace<B: Backend> {
63 fn vec_znx_big_add_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
65 where
66 R: VecZnxBigToMut<B>,
67 A: VecZnxBigToRef<B>;
68}
69
70pub trait VecZnxBigAddSmall<B: Backend> {
71 fn vec_znx_big_add_small<R, A, C>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
73 where
74 R: VecZnxBigToMut<B>,
75 A: VecZnxBigToRef<B>,
76 C: VecZnxToRef;
77}
78
79pub trait VecZnxBigAddSmallInplace<B: Backend> {
80 fn vec_znx_big_add_small_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
82 where
83 R: VecZnxBigToMut<B>,
84 A: VecZnxToRef;
85}
86
87pub trait VecZnxBigSub<B: Backend> {
88 fn vec_znx_big_sub<R, A, C>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
90 where
91 R: VecZnxBigToMut<B>,
92 A: VecZnxBigToRef<B>,
93 C: VecZnxBigToRef<B>;
94}
95
96pub trait VecZnxBigSubInplace<B: Backend> {
97 fn vec_znx_big_sub_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
99 where
100 R: VecZnxBigToMut<B>,
101 A: VecZnxBigToRef<B>;
102}
103
104pub trait VecZnxBigSubNegateInplace<B: Backend> {
105 fn vec_znx_big_sub_negate_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
107 where
108 R: VecZnxBigToMut<B>,
109 A: VecZnxBigToRef<B>;
110}
111
112pub trait VecZnxBigSubSmallA<B: Backend> {
113 fn vec_znx_big_sub_small_a<R, A, C>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
115 where
116 R: VecZnxBigToMut<B>,
117 A: VecZnxToRef,
118 C: VecZnxBigToRef<B>;
119}
120
121pub trait VecZnxBigSubSmallInplace<B: Backend> {
122 fn vec_znx_big_sub_small_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
124 where
125 R: VecZnxBigToMut<B>,
126 A: VecZnxToRef;
127}
128
129pub trait VecZnxBigSubSmallB<B: Backend> {
130 fn vec_znx_big_sub_small_b<R, A, C>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
132 where
133 R: VecZnxBigToMut<B>,
134 A: VecZnxBigToRef<B>,
135 C: VecZnxToRef;
136}
137
138pub trait VecZnxBigSubSmallNegateInplace<B: Backend> {
139 fn vec_znx_big_sub_small_negate_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
141 where
142 R: VecZnxBigToMut<B>,
143 A: VecZnxToRef;
144}
145
146pub trait VecZnxBigNegate<B: Backend> {
147 fn vec_znx_big_negate<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
148 where
149 R: VecZnxBigToMut<B>,
150 A: VecZnxBigToRef<B>;
151}
152
153pub trait VecZnxBigNegateInplace<B: Backend> {
154 fn vec_znx_big_negate_inplace<R>(&self, res: &mut R, res_col: usize)
155 where
156 R: VecZnxBigToMut<B>;
157}
158
159pub trait VecZnxBigNormalizeTmpBytes {
160 fn vec_znx_big_normalize_tmp_bytes(&self) -> usize;
161}
162
163#[allow(clippy::too_many_arguments)]
164pub trait VecZnxBigNormalize<B: Backend> {
165 fn vec_znx_big_normalize<R, A>(
166 &self,
167 res_base2k: usize,
168 res: &mut R,
169 res_col: usize,
170 a_base2k: usize,
171 a: &A,
172 a_col: usize,
173 scratch: &mut Scratch<B>,
174 ) where
175 R: VecZnxToMut,
176 A: VecZnxBigToRef<B>;
177}
178
179pub trait VecZnxBigAutomorphismInplaceTmpBytes {
180 fn vec_znx_big_automorphism_inplace_tmp_bytes(&self) -> usize;
181}
182
183pub trait VecZnxBigAutomorphism<B: Backend> {
184 fn vec_znx_big_automorphism<R, A>(&self, p: i64, res: &mut R, res_col: usize, a: &A, a_col: usize)
186 where
187 R: VecZnxBigToMut<B>,
188 A: VecZnxBigToRef<B>;
189}
190
191pub trait VecZnxBigAutomorphismInplace<B: Backend> {
192 fn vec_znx_big_automorphism_inplace<R>(&self, p: i64, res: &mut R, res_col: usize, scratch: &mut Scratch<B>)
194 where
195 R: VecZnxBigToMut<B>;
196}