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 VecZnxBigAllocBytes {
20 fn vec_znx_big_alloc_bytes(&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 basek: 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 VecZnxBigSubABInplace<B: Backend> {
97 fn vec_znx_big_sub_ab_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 VecZnxBigSubBAInplace<B: Backend> {
105 fn vec_znx_big_sub_ba_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 VecZnxBigSubSmallAInplace<B: Backend> {
122 fn vec_znx_big_sub_small_a_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 VecZnxBigSubSmallBInplace<B: Backend> {
139 fn vec_znx_big_sub_small_b_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
163pub trait VecZnxBigNormalize<B: Backend> {
164 fn vec_znx_big_normalize<R, A>(
165 &self,
166 basek: usize,
167 res: &mut R,
168 res_col: usize,
169 a: &A,
170 a_col: usize,
171 scratch: &mut Scratch<B>,
172 ) where
173 R: VecZnxToMut,
174 A: VecZnxBigToRef<B>;
175}
176
177pub trait VecZnxBigAutomorphismInplaceTmpBytes {
178 fn vec_znx_big_automorphism_inplace_tmp_bytes(&self) -> usize;
179}
180
181pub trait VecZnxBigAutomorphism<B: Backend> {
182 fn vec_znx_big_automorphism<R, A>(&self, p: i64, res: &mut R, res_col: usize, a: &A, a_col: usize)
184 where
185 R: VecZnxBigToMut<B>,
186 A: VecZnxBigToRef<B>;
187}
188
189pub trait VecZnxBigAutomorphismInplace<B: Backend> {
190 fn vec_znx_big_automorphism_inplace<R>(&self, p: i64, res: &mut R, res_col: usize, scratch: &mut Scratch<B>)
192 where
193 R: VecZnxBigToMut<B>;
194}