1use crate::{
2 api::{
3 VecZnxDftAdd, VecZnxDftAddInplace, VecZnxDftAlloc, VecZnxDftApply, VecZnxDftBytesOf, VecZnxDftCopy, VecZnxDftFromBytes,
4 VecZnxDftSub, VecZnxDftSubInplace, VecZnxDftSubNegateInplace, VecZnxDftZero, VecZnxIdftApply, VecZnxIdftApplyConsume,
5 VecZnxIdftApplyTmpA, VecZnxIdftApplyTmpBytes,
6 },
7 layouts::{
8 Backend, Data, Module, Scratch, VecZnxBig, VecZnxBigToMut, VecZnxDft, VecZnxDftOwned, VecZnxDftToMut, VecZnxDftToRef,
9 VecZnxToRef,
10 },
11 oep::{
12 VecZnxDftAddImpl, VecZnxDftAddInplaceImpl, VecZnxDftAllocBytesImpl, VecZnxDftAllocImpl, VecZnxDftApplyImpl,
13 VecZnxDftCopyImpl, VecZnxDftFromBytesImpl, VecZnxDftSubImpl, VecZnxDftSubInplaceImpl, VecZnxDftSubNegateInplaceImpl,
14 VecZnxDftZeroImpl, VecZnxIdftApplyConsumeImpl, VecZnxIdftApplyImpl, VecZnxIdftApplyTmpAImpl, VecZnxIdftApplyTmpBytesImpl,
15 },
16};
17
18impl<B> VecZnxDftFromBytes<B> for Module<B>
19where
20 B: Backend + VecZnxDftFromBytesImpl<B>,
21{
22 fn vec_znx_dft_from_bytes(&self, cols: usize, size: usize, bytes: Vec<u8>) -> VecZnxDftOwned<B> {
23 B::vec_znx_dft_from_bytes_impl(self.n(), cols, size, bytes)
24 }
25}
26
27impl<B> VecZnxDftBytesOf for Module<B>
28where
29 B: Backend + VecZnxDftAllocBytesImpl<B>,
30{
31 fn bytes_of_vec_znx_dft(&self, cols: usize, size: usize) -> usize {
32 B::vec_znx_dft_bytes_of_impl(self.n(), cols, size)
33 }
34}
35
36impl<B> VecZnxDftAlloc<B> for Module<B>
37where
38 B: Backend + VecZnxDftAllocImpl<B>,
39{
40 fn vec_znx_dft_alloc(&self, cols: usize, size: usize) -> VecZnxDftOwned<B> {
41 B::vec_znx_dft_alloc_impl(self.n(), cols, size)
42 }
43}
44
45impl<B> VecZnxIdftApplyTmpBytes for Module<B>
46where
47 B: Backend + VecZnxIdftApplyTmpBytesImpl<B>,
48{
49 fn vec_znx_idft_apply_tmp_bytes(&self) -> usize {
50 B::vec_znx_idft_apply_tmp_bytes_impl(self)
51 }
52}
53
54impl<B> VecZnxIdftApply<B> for Module<B>
55where
56 B: Backend + VecZnxIdftApplyImpl<B>,
57{
58 fn vec_znx_idft_apply<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, scratch: &mut Scratch<B>)
59 where
60 R: VecZnxBigToMut<B>,
61 A: VecZnxDftToRef<B>,
62 {
63 B::vec_znx_idft_apply_impl(self, res, res_col, a, a_col, scratch);
64 }
65}
66
67impl<B> VecZnxIdftApplyTmpA<B> for Module<B>
68where
69 B: Backend + VecZnxIdftApplyTmpAImpl<B>,
70{
71 fn vec_znx_idft_apply_tmpa<R, A>(&self, res: &mut R, res_col: usize, a: &mut A, a_col: usize)
72 where
73 R: VecZnxBigToMut<B>,
74 A: VecZnxDftToMut<B>,
75 {
76 B::vec_znx_idft_apply_tmpa_impl(self, res, res_col, a, a_col);
77 }
78}
79
80impl<B> VecZnxIdftApplyConsume<B> for Module<B>
81where
82 B: Backend + VecZnxIdftApplyConsumeImpl<B>,
83{
84 fn vec_znx_idft_apply_consume<D: Data>(&self, a: VecZnxDft<D, B>) -> VecZnxBig<D, B>
85 where
86 VecZnxDft<D, B>: VecZnxDftToMut<B>,
87 {
88 B::vec_znx_idft_apply_consume_impl(self, a)
89 }
90}
91
92impl<B> VecZnxDftApply<B> for Module<B>
93where
94 B: Backend + VecZnxDftApplyImpl<B>,
95{
96 fn vec_znx_dft_apply<R, A>(&self, step: usize, offset: usize, res: &mut R, res_col: usize, a: &A, a_col: usize)
97 where
98 R: VecZnxDftToMut<B>,
99 A: VecZnxToRef,
100 {
101 B::vec_znx_dft_apply_impl(self, step, offset, res, res_col, a, a_col);
102 }
103}
104
105impl<B> VecZnxDftAdd<B> for Module<B>
106where
107 B: Backend + VecZnxDftAddImpl<B>,
108{
109 fn vec_znx_dft_add<R, A, D>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &D, b_col: usize)
110 where
111 R: VecZnxDftToMut<B>,
112 A: VecZnxDftToRef<B>,
113 D: VecZnxDftToRef<B>,
114 {
115 B::vec_znx_dft_add_impl(self, res, res_col, a, a_col, b, b_col);
116 }
117}
118
119impl<B> VecZnxDftAddInplace<B> for Module<B>
120where
121 B: Backend + VecZnxDftAddInplaceImpl<B>,
122{
123 fn vec_znx_dft_add_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
124 where
125 R: VecZnxDftToMut<B>,
126 A: VecZnxDftToRef<B>,
127 {
128 B::vec_znx_dft_add_inplace_impl(self, res, res_col, a, a_col);
129 }
130}
131
132impl<B> VecZnxDftSub<B> for Module<B>
133where
134 B: Backend + VecZnxDftSubImpl<B>,
135{
136 fn vec_znx_dft_sub<R, A, D>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &D, b_col: usize)
137 where
138 R: VecZnxDftToMut<B>,
139 A: VecZnxDftToRef<B>,
140 D: VecZnxDftToRef<B>,
141 {
142 B::vec_znx_dft_sub_impl(self, res, res_col, a, a_col, b, b_col);
143 }
144}
145
146impl<B> VecZnxDftSubInplace<B> for Module<B>
147where
148 B: Backend + VecZnxDftSubInplaceImpl<B>,
149{
150 fn vec_znx_dft_sub_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
151 where
152 R: VecZnxDftToMut<B>,
153 A: VecZnxDftToRef<B>,
154 {
155 B::vec_znx_dft_sub_inplace_impl(self, res, res_col, a, a_col);
156 }
157}
158
159impl<B> VecZnxDftSubNegateInplace<B> for Module<B>
160where
161 B: Backend + VecZnxDftSubNegateInplaceImpl<B>,
162{
163 fn vec_znx_dft_sub_negate_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
164 where
165 R: VecZnxDftToMut<B>,
166 A: VecZnxDftToRef<B>,
167 {
168 B::vec_znx_dft_sub_negate_inplace_impl(self, res, res_col, a, a_col);
169 }
170}
171
172impl<B> VecZnxDftCopy<B> for Module<B>
173where
174 B: Backend + VecZnxDftCopyImpl<B>,
175{
176 fn vec_znx_dft_copy<R, A>(&self, step: usize, offset: usize, res: &mut R, res_col: usize, a: &A, a_col: usize)
177 where
178 R: VecZnxDftToMut<B>,
179 A: VecZnxDftToRef<B>,
180 {
181 B::vec_znx_dft_copy_impl(self, step, offset, res, res_col, a, a_col);
182 }
183}
184
185impl<B> VecZnxDftZero<B> for Module<B>
186where
187 B: Backend + VecZnxDftZeroImpl<B>,
188{
189 fn vec_znx_dft_zero<R>(&self, res: &mut R)
190 where
191 R: VecZnxDftToMut<B>,
192 {
193 B::vec_znx_dft_zero_impl(self, res);
194 }
195}